Issue #1431658 by Albert Volkman, xjm, kid_icarus, ChinggizKhan, rgristroph, connork: Massive API docs cleanup for system tests

8.0.x
Jennifer Hodgdon 2012-10-10 09:08:34 -07:00
parent 1c2b1b855d
commit 75035ae4da
80 changed files with 443 additions and 378 deletions

View File

@ -30,8 +30,7 @@ class ConfigurationTest extends WebTestBase {
} }
/** /**
* Test the configuration of advanced actions through the administration * Tests configuration of advanced actions through administration interface.
* interface.
*/ */
function testActionConfiguration() { function testActionConfiguration() {
// Create a user with permission to view the actions administration pages. // Create a user with permission to view the actions administration pages.

View File

@ -10,7 +10,7 @@ namespace Drupal\action\Tests;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
* Test actions executing in a potential loop, and make sure they abort properly. * Tests aborting of actions executing in a potential loop.
*/ */
class LoopTest extends WebTestBase { class LoopTest extends WebTestBase {
@ -32,7 +32,7 @@ class LoopTest extends WebTestBase {
} }
/** /**
* Set up a loop with 3 - 12 recursions, and see if it aborts properly. * Sets up a loop with 3 - 12 recursions, and sees if it aborts properly.
*/ */
function testActionLoop() { function testActionLoop() {
$user = $this->drupalCreateUser(array('administer actions')); $user = $this->drupalCreateUser(array('administer actions'));
@ -55,7 +55,9 @@ class LoopTest extends WebTestBase {
} }
/** /**
* Create an infinite loop by causing a watchdog message to be set, * Loops watchdog messages up to actions_max_stack times.
*
* Creates an infinite loop by causing a watchdog message to be set,
* which causes the actions to be triggered again, up to action_max_stack * which causes the actions to be triggered again, up to action_max_stack
* times. * times.
*/ */

View File

@ -22,7 +22,7 @@ abstract class AjaxTestBase extends WebTestBase {
public static $modules = array('ajax_test', 'ajax_forms_test'); public static $modules = array('ajax_test', 'ajax_forms_test');
/** /**
* Assert that a command with the required properties exists within the array of Ajax commands returned by the server. * Asserts the array of Ajax commands contains the searched command.
* *
* The Ajax framework, via the ajax_render() function, returns an array of * The Ajax framework, via the ajax_render() function, returns an array of
* commands. This array sometimes includes commands automatically provided by * commands. This array sometimes includes commands automatically provided by

View File

@ -20,7 +20,7 @@ class CommandsTest extends AjaxTestBase {
} }
/** /**
* Test the various Ajax Commands. * Tests the various Ajax Commands.
*/ */
function testAjaxCommands() { function testAjaxCommands() {
$form_path = 'ajax_forms_test_ajax_commands_form'; $form_path = 'ajax_forms_test_ajax_commands_form';

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Ajax; namespace Drupal\system\Tests\Ajax;
/** /**
* Miscellaneous Ajax tests using ajax_test module. * Tests using ajax_test module.
*/ */
class ElementValidationTest extends AjaxTestBase { class ElementValidationTest extends AjaxTestBase {
public static function getInfo() { public static function getInfo() {
@ -20,7 +20,7 @@ class ElementValidationTest extends AjaxTestBase {
} }
/** /**
* Try to post an Ajax change to a form that has a validated element. * Tries 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 * is set to be a required field. In this test the required field is not

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Ajax; namespace Drupal\system\Tests\Ajax;
/** /**
* Test that $form_state['values'] is properly delivered to $ajax['callback']. * Tests that $form_state['values'] is properly delivered to $ajax['callback'].
*/ */
class FormValuesTest extends AjaxTestBase { class FormValuesTest extends AjaxTestBase {
public static function getInfo() { public static function getInfo() {
@ -27,7 +27,7 @@ class FormValuesTest extends AjaxTestBase {
} }
/** /**
* Create a simple form, then POST to system/ajax to change to it. * Submits forms with select and checkbox elements via AJAX.
*/ */
function testSimpleAjaxFormValue() { function testSimpleAjaxFormValue() {
// Verify form values of a select element. // Verify form values of a select element.

View File

@ -20,7 +20,7 @@ class FrameworkTest extends AjaxTestBase {
} }
/** /**
* Test that ajax_render() returns JavaScript settings generated during the page request. * Ensures ajax_render() returns JavaScript settings from the page request.
* *
* @todo Add tests to ensure that ajax_render() returns commands for new CSS * @todo Add tests to ensure that ajax_render() returns commands for new CSS
* and JavaScript files to be loaded by the page. See * and JavaScript files to be loaded by the page. See
@ -45,7 +45,7 @@ class FrameworkTest extends AjaxTestBase {
} }
/** /**
* Test behavior of ajax_render_error(). * Tests behavior of ajax_render_error().
*/ */
function testAJAXRenderError() { function testAJAXRenderError() {
// Verify default error message. // Verify default error message.
@ -69,7 +69,7 @@ class FrameworkTest extends AjaxTestBase {
} }
/** /**
* Test that new JavaScript and CSS files added during an AJAX request are returned. * Tests that new JavaScript and CSS files are returned on an AJAX request.
*/ */
function testLazyLoad() { function testLazyLoad() {
$expected = array( $expected = array(

View File

@ -53,7 +53,7 @@ class MultiFormTest extends AjaxTestBase {
} }
/** /**
* Test that a page with the 'page_node_form' included twice works correctly. * Tests that pages with the 'page_node_form' included twice works correctly.
*/ */
function testMultiForm() { function testMultiForm() {
// HTML IDs for elements within the field are potentially modified with // HTML IDs for elements within the field are potentially modified with

View File

@ -81,7 +81,7 @@ class PercentagesUnitTest extends UnitTestBase {
} }
/** /**
* Test the _batch_api_percentage() function. * Tests the _batch_api_percentage() function.
*/ */
function testBatchPercentages() { function testBatchPercentages() {
foreach ($this->testCases as $expected_result => $arguments) { foreach ($this->testCases as $expected_result => $arguments) {

View File

@ -30,7 +30,7 @@ class ProcessingTest extends WebTestBase {
} }
/** /**
* Test batches triggered outside of form submission. * Tests batches triggered outside of form submission.
*/ */
function testBatchNoForm() { function testBatchNoForm() {
// Displaying the page triggers batch 1. // Displaying the page triggers batch 1.
@ -41,7 +41,7 @@ class ProcessingTest extends WebTestBase {
} }
/** /**
* Test batches defined in a form submit handler. * Tests batches defined in a form submit handler.
*/ */
function testBatchForm() { function testBatchForm() {
// Batch 0: no operation. // Batch 0: no operation.
@ -80,7 +80,7 @@ class ProcessingTest extends WebTestBase {
} }
/** /**
* Test batches defined in a multistep form. * Tests batches defined in a multistep form.
*/ */
function testBatchFormMultistep() { function testBatchFormMultistep() {
$this->drupalGet('batch-test/multistep'); $this->drupalGet('batch-test/multistep');
@ -100,7 +100,7 @@ class ProcessingTest extends WebTestBase {
} }
/** /**
* Test batches defined in different submit handlers on the same form. * Tests batches defined in different submit handlers on the same form.
*/ */
function testBatchFormMultipleBatches() { function testBatchFormMultipleBatches() {
// Batches 1, 2 and 3 are triggered in sequence by different submit // Batches 1, 2 and 3 are triggered in sequence by different submit
@ -117,7 +117,7 @@ class ProcessingTest extends WebTestBase {
} }
/** /**
* Test batches defined in a programmatically submitted form. * Tests batches defined in a programmatically submitted form.
* *
* Same as above, but the form is submitted through drupal_form_execute(). * Same as above, but the form is submitted through drupal_form_execute().
*/ */
@ -135,7 +135,7 @@ class ProcessingTest extends WebTestBase {
} }
/** /**
* Test that drupal_form_submit() can run within a batch operation. * Tests that drupal_form_submit() can run within a batch operation.
*/ */
function testDrupalFormSubmitInBatch() { function testDrupalFormSubmitInBatch() {
// Displaying the page triggers a batch that programmatically submits a // Displaying the page triggers a batch that programmatically submits a
@ -146,8 +146,9 @@ class ProcessingTest extends WebTestBase {
} }
/** /**
* Test batches that return $context['finished'] > 1 do in fact complete. * Tests batches that return $context['finished'] > 1 do in fact complete.
* See http://drupal.org/node/600836 *
* @see http://drupal.org/node/600836
*/ */
function testBatchLargePercentage() { function testBatchLargePercentage() {
// Displaying the page triggers batch 5. // Displaying the page triggers batch 5.
@ -159,7 +160,7 @@ class ProcessingTest extends WebTestBase {
/** /**
* Will trigger a pass if the texts were found in order in the raw content. * Triggers a pass if the texts were found in order in the raw content.
* *
* @param $texts * @param $texts
* Array of raw strings to look for . * Array of raw strings to look for .
@ -174,7 +175,7 @@ class ProcessingTest extends WebTestBase {
} }
/** /**
* Helper function: return expected execution stacks for the test batches. * Returns expected execution stacks for the test batches.
*/ */
function _resultStack($id, $value = 0) { function _resultStack($id, $value = 0) {
$stack = array(); $stack = array();
@ -241,7 +242,7 @@ class ProcessingTest extends WebTestBase {
} }
/** /**
* Helper function: return expected result messages for the test batches. * Returns expected result messages for the test batches.
*/ */
function _resultMessages($id) { function _resultMessages($id) {
$messages = array(); $messages = array();

View File

@ -23,7 +23,7 @@ class GetFilenameUnitTest extends UnitTestBase {
} }
/** /**
* Test that drupal_get_filename() works correctly when the file is not found in the database. * Tests that drupal_get_filename() works when the file is not in database.
*/ */
function testDrupalGetFilename() { function testDrupalGetFilename() {
// Reset the static cache so we can test the "db is not active" code of // Reset the static cache so we can test the "db is not active" code of

View File

@ -30,7 +30,7 @@ class HookBootExitTest extends WebTestBase {
} }
/** /**
* Test calling of hook_boot() and hook_exit(). * Tests calling of hook_boot() and hook_exit().
*/ */
function testHookBootExit() { function testHookBootExit() {
// Test with cache disabled. Boot and exit should always fire. // Test with cache disabled. Boot and exit should always fire.

View File

@ -48,7 +48,7 @@ class IpAddressTest extends WebTestBase {
} }
/** /**
* test IP Address and hostname * Tests IP address and hostname.
*/ */
function testIPAddressHost() { function testIPAddressHost() {
// Test the normal IP address. // Test the normal IP address.

View File

@ -23,7 +23,7 @@ class MiscUnitTest extends UnitTestBase {
} }
/** /**
* Test miscellaneous functions in bootstrap.inc. * Tests miscellaneous functions in bootstrap.inc.
*/ */
function testMisc() { function testMisc() {
// Test drupal_array_merge_deep(). // Test drupal_array_merge_deep().

View File

@ -22,7 +22,7 @@ class OverrideServerVariablesUnitTest extends UnitTestBase {
} }
/** /**
* Test providing a direct URL to to drupal_override_server_variables(). * Tests providing a direct URL to to drupal_override_server_variables().
*/ */
function testDrupalOverrideServerVariablesProvidedURL() { function testDrupalOverrideServerVariablesProvidedURL() {
$tests = array( $tests = array(

View File

@ -39,7 +39,7 @@ class PageCacheTest extends WebTestBase {
} }
/** /**
* Test support for requests containing If-Modified-Since and If-None-Match headers. * Tests support of requests with If-Modified-Since and If-None-Match headers.
*/ */
function testConditionalRequests() { function testConditionalRequests() {
$config = config('system.performance'); $config = config('system.performance');
@ -83,7 +83,7 @@ class PageCacheTest extends WebTestBase {
} }
/** /**
* Test cache headers. * Tests cache headers.
*/ */
function testPageCache() { function testPageCache() {
$config = config('system.performance'); $config = config('system.performance');
@ -125,7 +125,7 @@ class PageCacheTest extends WebTestBase {
} }
/** /**
* Test page compression. * Tests page compression.
* *
* The test should pass even if zlib.output_compression is enabled in php.ini, * The test should pass even if zlib.output_compression is enabled in php.ini,
* .htaccess or similar, or if compression is done outside PHP, e.g. by the * .htaccess or similar, or if compression is done outside PHP, e.g. by the

View File

@ -23,7 +23,9 @@ class ResettableStaticUnitTest extends UnitTestBase {
} }
/** /**
* Test that a variable reference returned by drupal_static() gets reset when * Tests drupal_static() function.
*
* Tests that a variable reference returned by drupal_static() gets reset when
* drupal_static_reset() is called. * drupal_static_reset() is called.
*/ */
function testDrupalStatic() { function testDrupalStatic() {

View File

@ -23,9 +23,7 @@ class TimerUnitTest extends UnitTestBase {
} }
/** /**
* Test timer_read() to ensure it properly accumulates time when the timer * Tests timer_read() time accumulation accuracy across multiple restarts.
* started and stopped multiple times.
* @return
*/ */
function testTimer() { function testTimer() {
timer_start('test'); timer_start('test');

View File

@ -30,7 +30,7 @@ class VariableTest extends WebTestBase {
} }
/** /**
* testVariable * Tests variables then deletes them.
*/ */
function testVariable() { function testVariable() {
// Setting and retrieving values. // Setting and retrieving values.

View File

@ -19,7 +19,7 @@ abstract class CacheTestBase extends WebTestBase {
protected $default_value = 'CacheTest'; protected $default_value = 'CacheTest';
/** /**
* Check whether or not a cache entry exists. * Checks whether or not a cache entry exists.
* *
* @param $cid * @param $cid
* The cache id. * The cache id.
@ -89,7 +89,8 @@ abstract class CacheTestBase extends WebTestBase {
} }
/** /**
* Perform the general wipe. * Performs a general wipe of the bin.
*
* @param $bin * @param $bin
* The bin to perform the wipe on. * The bin to perform the wipe on.
*/ */

View File

@ -28,7 +28,7 @@ class ClearTest extends CacheTestBase {
} }
/** /**
* Test drupal_flush_all_caches(). * Tests drupal_flush_all_caches().
*/ */
function testFlushAllCaches() { function testFlushAllCaches() {
// Create cache entries for each flushed cache bin. // Create cache entries for each flushed cache bin.

View File

@ -128,8 +128,7 @@ abstract class GenericCacheBackendUnitTestBase extends UnitTestBase {
} }
/** /**
* Test Drupal\Core\Cache\CacheBackendInterface::get() and * Tests the get and set methods of Drupal\Core\Cache\CacheBackendInterface.
* Drupal\Core\Cache\CacheBackendInterface::set().
*/ */
public function testSetGet() { public function testSetGet() {
$backend = $this->getCacheBackend(); $backend = $this->getCacheBackend();
@ -150,7 +149,7 @@ abstract class GenericCacheBackendUnitTestBase extends UnitTestBase {
} }
/** /**
* Test Drupal\Core\Cache\CacheBackendInterface::delete(). * Tests Drupal\Core\Cache\CacheBackendInterface::delete().
*/ */
public function testDelete() { public function testDelete() {
$backend = $this->getCacheBackend(); $backend = $this->getCacheBackend();
@ -174,7 +173,7 @@ abstract class GenericCacheBackendUnitTestBase extends UnitTestBase {
} }
/** /**
* Test data type perservation. * Tests data type preservation.
*/ */
public function testValueTypeIsKept() { public function testValueTypeIsKept() {
$backend = $this->getCacheBackend(); $backend = $this->getCacheBackend();
@ -202,7 +201,7 @@ abstract class GenericCacheBackendUnitTestBase extends UnitTestBase {
} }
/** /**
* Test Drupal\Core\Cache\CacheBackendInterface::getMultiple(). * Tests Drupal\Core\Cache\CacheBackendInterface::getMultiple().
*/ */
public function testGetMultiple() { public function testGetMultiple() {
$backend = $this->getCacheBackend(); $backend = $this->getCacheBackend();
@ -281,7 +280,7 @@ abstract class GenericCacheBackendUnitTestBase extends UnitTestBase {
} }
/** /**
* Test Drupal\Core\Cache\CacheBackendInterface::isEmpty(). * Tests Drupal\Core\Cache\CacheBackendInterface::isEmpty().
*/ */
public function testIsEmpty() { public function testIsEmpty() {
$backend = $this->getCacheBackend(); $backend = $this->getCacheBackend();
@ -296,7 +295,7 @@ abstract class GenericCacheBackendUnitTestBase extends UnitTestBase {
} }
/** /**
* Test Drupal\Core\Cache\CacheBackendInterface::deleteMultiple(). * Tests Drupal\Core\Cache\CacheBackendInterface::deleteMultiple().
*/ */
public function testDeleteMultiple() { public function testDeleteMultiple() {
$backend = $this->getCacheBackend(); $backend = $this->getCacheBackend();
@ -354,7 +353,7 @@ abstract class GenericCacheBackendUnitTestBase extends UnitTestBase {
} }
/** /**
* Check whether or not a cache entry exists. * Checks whether or not a cache entry exists.
* *
* @param $cid * @param $cid
* The cache id. * The cache id.
@ -370,7 +369,7 @@ abstract class GenericCacheBackendUnitTestBase extends UnitTestBase {
} }
/** /**
* Test Drupal\Core\Cache\CacheBackendInterface::invalidateTags(). * Tests Drupal\Core\Cache\CacheBackendInterface::invalidateTags().
*/ */
function testClearTags() { function testClearTags() {
$backend = $this->getCacheBackend(); $backend = $this->getCacheBackend();

View File

@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Common;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
* Basic tests for drupal_add_feed(). * Tests drupal_add_feed().
*/ */
class AddFeedTest extends WebTestBase { class AddFeedTest extends WebTestBase {
public static function getInfo() { public static function getInfo() {
@ -22,7 +22,7 @@ class AddFeedTest extends WebTestBase {
} }
/** /**
* Test drupal_add_feed() with paths, URLs, and titles. * Tests drupal_add_feed() with paths, URLs, and titles.
*/ */
function testBasicFeedAddNoTitle() { function testBasicFeedAddNoTitle() {
$path = $this->randomName(12); $path = $this->randomName(12);
@ -81,7 +81,7 @@ class AddFeedTest extends WebTestBase {
} }
/** /**
* Create a pattern representing the RSS feed in the page. * Creates a pattern representing the RSS feed in the page.
*/ */
function urlToRSSLinkPattern($url, $title = '') { function urlToRSSLinkPattern($url, $title = '') {
// Escape any regular expression characters in the URL ('?' is the worst). // Escape any regular expression characters in the URL ('?' is the worst).

View File

@ -30,6 +30,9 @@ class AlterTest extends WebTestBase {
); );
} }
/**
* Tests if the theme has been altered.
*/
function testDrupalAlter() { function testDrupalAlter() {
// This test depends on Bartik, so make sure that it is always the current // This test depends on Bartik, so make sure that it is always the current
// active theme. // active theme.

View File

@ -29,7 +29,7 @@ class AutocompleteTagsUnitTest extends UnitTestBase {
} }
/** /**
* Explode a series of tags. * Explodes a series of tags.
*/ */
function testDrupalExplodeTags() { function testDrupalExplodeTags() {
$string = implode(', ', array_keys($this->validTags)); $string = implode(', ', array_keys($this->validTags));
@ -38,7 +38,7 @@ class AutocompleteTagsUnitTest extends UnitTestBase {
} }
/** /**
* Implode a series of tags. * Implodes a series of tags.
*/ */
function testDrupalImplodeTags() { function testDrupalImplodeTags() {
$tags = array_values($this->validTags); $tags = array_values($this->validTags);

View File

@ -36,14 +36,14 @@ class CascadingStylesheetsTest extends WebTestBase {
} }
/** /**
* Check default stylesheets as empty. * Checks that default stylesheets are empty.
*/ */
function testDefault() { function testDefault() {
$this->assertEqual(array(), drupal_add_css(), 'Default CSS is empty.'); $this->assertEqual(array(), drupal_add_css(), 'Default CSS is empty.');
} }
/** /**
* Test that stylesheets in module .info files are loaded. * Tests that stylesheets in module .info files are loaded.
*/ */
function testModuleInfo() { function testModuleInfo() {
$this->drupalGet(''); $this->drupalGet('');
@ -172,7 +172,7 @@ class CascadingStylesheetsTest extends WebTestBase {
} }
/** /**
* Test CSS ordering. * Tests CSS ordering.
*/ */
function testRenderOrder() { function testRenderOrder() {
// A module CSS file. // A module CSS file.
@ -203,7 +203,7 @@ class CascadingStylesheetsTest extends WebTestBase {
} }
/** /**
* Test CSS override. * Tests CSS override.
*/ */
function testRenderOverride() { function testRenderOverride() {
$system = drupal_get_path('module', 'system'); $system = drupal_get_path('module', 'system');
@ -244,8 +244,7 @@ class CascadingStylesheetsTest extends WebTestBase {
} }
/** /**
* Tests that the query string remains intact when adding CSS files that have * Tests that CSS query string remains intact when added to file.
* query string parameters.
*/ */
function testAddCssFileWithQueryString() { function testAddCssFileWithQueryString() {
$this->drupalGet('common-test/query-string'); $this->drupalGet('common-test/query-string');

View File

@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Common;
use Drupal\simpletest\UnitTestBase; use Drupal\simpletest\UnitTestBase;
/** /**
* CSS Unit Tests. * Tests CSS functions.
*/ */
class CascadingStylesheetsUnitTest extends UnitTestBase { class CascadingStylesheetsUnitTest extends UnitTestBase {
public static function getInfo() { public static function getInfo() {
@ -22,8 +22,9 @@ class CascadingStylesheetsUnitTest extends UnitTestBase {
} }
/** /**
* Tests basic CSS loading with and without optimization via drupal_load_stylesheet(). * Tests CSS loading via drupal_load_stylesheet().
* *
* This test loads CSS files with and without CSS optimization.
* Known tests: * Known tests:
* - Retain white-space in selectors. (http://drupal.org/node/472820) * - Retain white-space in selectors. (http://drupal.org/node/472820)
* - Proper URLs in imported files. (http://drupal.org/node/265719) * - Proper URLs in imported files. (http://drupal.org/node/265719)

View File

@ -48,7 +48,7 @@ class FormatDateTest extends WebTestBase {
} }
/** /**
* Test admin-defined formats in format_date(). * Tests admin-defined formats in format_date().
*/ */
function testAdminDefinedFormatDate() { function testAdminDefinedFormatDate() {
// Create an admin user. // Create an admin user.

View File

@ -30,7 +30,7 @@ class GotoTest extends WebTestBase {
} }
/** /**
* Test drupal_goto(). * Tests drupal_goto().
*/ */
function testDrupalGoto() { function testDrupalGoto() {
$this->drupalGet('common-test/drupal_goto/redirect'); $this->drupalGet('common-test/drupal_goto/redirect');
@ -56,7 +56,7 @@ class GotoTest extends WebTestBase {
} }
/** /**
* Test hook_drupal_goto_alter(). * Tests hook_drupal_goto_alter().
*/ */
function testDrupalGotoAlter() { function testDrupalGotoAlter() {
$this->drupalGet('common-test/drupal_goto/redirect_fail'); $this->drupalGet('common-test/drupal_goto/redirect_fail');
@ -66,7 +66,7 @@ class GotoTest extends WebTestBase {
} }
/** /**
* Test drupal_get_destination(). * Tests drupal_get_destination().
*/ */
function testDrupalGetDestination() { function testDrupalGetDestination() {
$query = $this->randomName(10); $query = $this->randomName(10);

View File

@ -30,6 +30,9 @@ class HttpRequestTest extends WebTestBase {
); );
} }
/**
* Checks HTTP requests.
*/
function testDrupalHTTPRequest() { function testDrupalHTTPRequest() {
global $is_https; global $is_https;
@ -73,6 +76,9 @@ class HttpRequestTest extends WebTestBase {
} }
} }
/**
* Tests HTTP basic authorization.
*/
function testDrupalHTTPRequestBasicAuth() { function testDrupalHTTPRequestBasicAuth() {
$username = $this->randomName(); $username = $this->randomName();
$password = $this->randomName(); $password = $this->randomName();
@ -86,6 +92,9 @@ class HttpRequestTest extends WebTestBase {
$this->assertRaw($password, '$_SERVER["PHP_AUTH_PW"] is passed correctly.'); $this->assertRaw($password, '$_SERVER["PHP_AUTH_PW"] is passed correctly.');
} }
/**
* Tests HTTP redirect requests.
*/
function testDrupalHTTPRequestRedirect() { function testDrupalHTTPRequestRedirect() {
$redirect_301 = drupal_http_request(url('system-test/redirect/301', array('absolute' => TRUE)), array('max_redirects' => 1)); $redirect_301 = drupal_http_request(url('system-test/redirect/301', array('absolute' => TRUE)), array('max_redirects' => 1));
$this->assertEqual($redirect_301->redirect_code, 301, 'drupal_http_request follows the 301 redirect.'); $this->assertEqual($redirect_301->redirect_code, 301, 'drupal_http_request follows the 301 redirect.');

View File

@ -22,7 +22,7 @@ class JavaScriptTest extends WebTestBase {
public static $modules = array('language', 'simpletest', 'common_test', 'path'); public static $modules = array('language', 'simpletest', 'common_test', 'path');
/** /**
* Store configured value for JavaScript preprocessing. * Stores configured value for JavaScript preprocessing.
*/ */
protected $preprocess_js = NULL; protected $preprocess_js = NULL;
@ -57,14 +57,14 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test default JavaScript is empty. * Tests that default JavaScript is empty.
*/ */
function testDefault() { function testDefault() {
$this->assertEqual(array(), drupal_add_js(), 'Default JavaScript is empty.'); $this->assertEqual(array(), drupal_add_js(), 'Default JavaScript is empty.');
} }
/** /**
* Test adding a JavaScript file. * Tests adding a JavaScript file.
*/ */
function testAddFile() { function testAddFile() {
$javascript = drupal_add_js('core/misc/collapse.js'); $javascript = drupal_add_js('core/misc/collapse.js');
@ -72,7 +72,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test adding settings. * Tests adding settings.
*/ */
function testAddSetting() { function testAddSetting() {
// Add a file in order to test default settings. // Add a file in order to test default settings.
@ -133,7 +133,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test drupal_get_js() for JavaScript settings. * Tests drupal_get_js() for JavaScript settings.
*/ */
function testHeaderSetting() { function testHeaderSetting() {
drupal_add_library('system', 'drupalSettings'); drupal_add_library('system', 'drupalSettings');
@ -179,7 +179,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test to see if resetting the JavaScript empties the cache. * Tests to see if resetting the JavaScript empties the cache.
*/ */
function testReset() { function testReset() {
drupal_add_library('system', 'drupal'); drupal_add_library('system', 'drupal');
@ -189,7 +189,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test adding inline scripts. * Tests adding inline scripts.
*/ */
function testAddInline() { function testAddInline() {
drupal_add_library('system', 'drupal'); drupal_add_library('system', 'drupal');
@ -201,7 +201,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test rendering an external JavaScript file. * Tests rendering an external JavaScript file.
*/ */
function testRenderExternal() { function testRenderExternal() {
drupal_add_library('system', 'drupal'); drupal_add_library('system', 'drupal');
@ -213,7 +213,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test drupal_get_js() with a footer scope. * Tests drupal_get_js() with a footer scope.
*/ */
function testFooterHTML() { function testFooterHTML() {
drupal_add_library('system', 'drupal'); drupal_add_library('system', 'drupal');
@ -224,7 +224,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test drupal_add_js() sets preproccess to false when cache is set to false. * Tests drupal_add_js() sets preproccess to FALSE when cache is also FALSE.
*/ */
function testNoCache() { function testNoCache() {
drupal_add_library('system', 'drupal'); drupal_add_library('system', 'drupal');
@ -233,7 +233,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test adding a JavaScript file with a different group. * Tests adding a JavaScript file with a different group.
*/ */
function testDifferentGroup() { function testDifferentGroup() {
drupal_add_library('system', 'drupal'); drupal_add_library('system', 'drupal');
@ -242,7 +242,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test adding a JavaScript file with a different weight. * Tests adding a JavaScript file with a different weight.
*/ */
function testDifferentWeight() { function testDifferentWeight() {
$javascript = drupal_add_js('core/misc/collapse.js', array('weight' => 2)); $javascript = drupal_add_js('core/misc/collapse.js', array('weight' => 2));
@ -250,7 +250,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test adding JavaScript within conditional comments. * Tests adding JavaScript within conditional comments.
* *
* @see drupal_pre_render_conditional_comments() * @see drupal_pre_render_conditional_comments()
*/ */
@ -270,7 +270,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test JavaScript versioning. * Tests JavaScript versioning.
*/ */
function testVersionQueryString() { function testVersionQueryString() {
drupal_add_library('system', 'drupal'); drupal_add_library('system', 'drupal');
@ -281,7 +281,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test JavaScript grouping and aggregation. * Tests JavaScript grouping and aggregation.
*/ */
function testAggregation() { function testAggregation() {
$default_query_string = variable_get('css_js_query_string', '0'); $default_query_string = variable_get('css_js_query_string', '0');
@ -369,7 +369,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test JavaScript ordering. * Tests JavaScript ordering.
*/ */
function testRenderOrder() { function testRenderOrder() {
// Add a bunch of JavaScript in strange ordering. // Add a bunch of JavaScript in strange ordering.
@ -411,7 +411,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test rendering the JavaScript with a file's weight above jQuery's. * Tests rendering the JavaScript with a file's weight above jQuery's.
*/ */
function testRenderDifferentWeight() { function testRenderDifferentWeight() {
// JavaScript files are sorted first by group, then by the 'every_page' // JavaScript files are sorted first by group, then by the 'every_page'
@ -424,7 +424,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Test altering a JavaScript's weight via hook_js_alter(). * Tests altering a JavaScript's weight via hook_js_alter().
* *
* @see simpletest_js_alter() * @see simpletest_js_alter()
*/ */
@ -523,8 +523,7 @@ class JavaScriptTest extends WebTestBase {
} }
/** /**
* Tests that the query string remains intact when adding JavaScript files * Tests JavaScript files that have querystrings attached get added right.
* that have query string parameters.
*/ */
function testAddJsFileWithQueryString() { function testAddJsFileWithQueryString() {
$this->drupalGet('common-test/query-string'); $this->drupalGet('common-test/query-string');

View File

@ -22,7 +22,7 @@ class ParseInfoFileUnitTest extends UnitTestBase {
} }
/** /**
* Parse an example .info file an verify the results. * Parses an example .info file and verifies the results.
*/ */
function testParseInfoFile() { function testParseInfoFile() {
$info_values = drupal_parse_info_file(drupal_get_path('module', 'system') . '/tests/common_test_info.txt'); $info_values = drupal_parse_info_file(drupal_get_path('module', 'system') . '/tests/common_test_info.txt');

View File

@ -22,7 +22,7 @@ class RegionContentTest extends WebTestBase {
} }
/** /**
* Test setting and retrieving content for theme regions. * Tests setting and retrieving content for theme regions.
*/ */
function testRegions() { function testRegions() {
global $theme_key; global $theme_key;

View File

@ -30,7 +30,7 @@ class RenderTest extends WebTestBase {
} }
/** /**
* Test sorting by weight. * Tests sorting by weight.
*/ */
function testDrupalRenderSorting() { function testDrupalRenderSorting() {
$first = $this->randomName(); $first = $this->randomName();
@ -81,7 +81,7 @@ class RenderTest extends WebTestBase {
} }
/** /**
* Test #attached functionality in children elements. * Tests #attached functionality in children elements.
*/ */
function testDrupalRenderChildrenAttached() { function testDrupalRenderChildrenAttached() {
// The cache system is turned off for POST requests. // The cache system is turned off for POST requests.
@ -131,7 +131,7 @@ class RenderTest extends WebTestBase {
} }
/** /**
* Test passing arguments to the theme function. * Tests passing arguments to the theme function.
*/ */
function testDrupalRenderThemeArguments() { function testDrupalRenderThemeArguments() {
$element = array( $element = array(
@ -144,12 +144,12 @@ class RenderTest extends WebTestBase {
'#foo' => $this->randomName(), '#foo' => $this->randomName(),
'#bar' => $this->randomName(), '#bar' => $this->randomName(),
); );
// Test that passing arguments to the theme function works. // Tests that passing arguments to the theme function works.
$this->assertEqual(drupal_render($element), $element['#foo'] . $element['#bar'], 'Passing arguments to theme functions works'); $this->assertEqual(drupal_render($element), $element['#foo'] . $element['#bar'], 'Passing arguments to theme functions works');
} }
/** /**
* Test rendering form elements without passing through form_builder(). * Tests rendering form elements without passing through form_builder().
*/ */
function testDrupalRenderFormElements() { function testDrupalRenderFormElements() {
// Define a series of form elements. // Define a series of form elements.
@ -268,7 +268,7 @@ class RenderTest extends WebTestBase {
} }
/** /**
* Test rendering elements with invalid keys. * Tests rendering elements with invalid keys.
*/ */
function testDrupalRenderInvalidKeys() { function testDrupalRenderInvalidKeys() {
$error = array( $error = array(
@ -284,6 +284,9 @@ class RenderTest extends WebTestBase {
$this->assertRaw($message, format_string('Found error message: !message.', array('!message' => $message))); $this->assertRaw($message, format_string('Found error message: !message.', array('!message' => $message)));
} }
/**
* Tests that elements are rendered properly.
*/
protected function assertRenderedElement(array $element, $xpath, array $xpath_args = array()) { protected function assertRenderedElement(array $element, $xpath, array $xpath_args = array()) {
$original_element = $element; $original_element = $element;
$this->drupalSetContent(drupal_render($element)); $this->drupalSetContent(drupal_render($element));

View File

@ -40,7 +40,7 @@ class SimpleTestErrorCollectorTest extends WebTestBase {
} }
/** /**
* Test that simpletest collects errors from the tested site. * Tests that simpletest collects errors from the tested site.
*/ */
function testErrorCollect() { function testErrorCollect() {
$this->collectedErrors = array(); $this->collectedErrors = array();
@ -91,7 +91,7 @@ class SimpleTestErrorCollectorTest extends WebTestBase {
} }
/** /**
* Assert that a collected error matches what we are expecting. * Asserts that a collected error matches what we are expecting.
*/ */
function assertError($error, $group, $function, $file, $message = NULL) { function assertError($error, $group, $function, $file, $message = NULL) {
$this->assertEqual($error['group'], $group, format_string("Group was %group", array('%group' => $group))); $this->assertEqual($error['group'], $group, format_string("Group was %group", array('%group' => $group)));

View File

@ -48,7 +48,7 @@ class SizeUnitTest extends UnitTestBase {
} }
/** /**
* Check that format_size() returns the expected string. * Checks that format_size() returns the expected string.
*/ */
function testCommonFormatSize() { function testCommonFormatSize() {
foreach (array($this->exact_test_cases, $this->rounded_test_cases) as $test_cases) { foreach (array($this->exact_test_cases, $this->rounded_test_cases) as $test_cases) {
@ -63,7 +63,7 @@ class SizeUnitTest extends UnitTestBase {
} }
/** /**
* Check that parse_size() returns the proper byte sizes. * Checks that parse_size() returns the proper byte sizes.
*/ */
function testCommonParseSize() { function testCommonParseSize() {
foreach ($this->exact_test_cases as $string => $size) { foreach ($this->exact_test_cases as $string => $size) {
@ -96,7 +96,7 @@ class SizeUnitTest extends UnitTestBase {
} }
/** /**
* Cross-test parse_size() and format_size(). * Cross-tests parse_size() and format_size().
*/ */
function testCommonParseSizeFormatSize() { function testCommonParseSizeFormatSize() {
foreach ($this->exact_test_cases as $size) { foreach ($this->exact_test_cases as $size) {

View File

@ -22,7 +22,7 @@ class SystemListingTest extends WebTestBase {
} }
/** /**
* Test that files in different directories take precedence as expected. * Tests that files in different directories take precedence as expected.
*/ */
function testDirectoryPrecedence() { function testDirectoryPrecedence() {
// Define the module files we will search for, and the directory precedence // Define the module files we will search for, and the directory precedence

View File

@ -25,7 +25,7 @@ class UrlTest extends WebTestBase {
} }
/** /**
* Confirm that invalid text given as $path is filtered. * Confirms that invalid URLs are filtered.
*/ */
function testLXSS() { function testLXSS() {
$text = $this->randomName(); $text = $this->randomName();
@ -58,7 +58,7 @@ class UrlTest extends WebTestBase {
} }
/** /**
* Test drupal_get_query_parameters(). * Tests drupal_get_query_parameters().
*/ */
function testDrupalGetQueryParameters() { function testDrupalGetQueryParameters() {
$original = array( $original = array(
@ -94,7 +94,7 @@ class UrlTest extends WebTestBase {
} }
/** /**
* Test drupal_http_build_query(). * Tests drupal_http_build_query().
*/ */
function testDrupalHttpBuildQuery() { function testDrupalHttpBuildQuery() {
$this->assertEqual(drupal_http_build_query(array('a' => ' &#//+%20@۞')), 'a=%20%26%23//%2B%2520%40%DB%9E', 'Value was properly encoded.'); $this->assertEqual(drupal_http_build_query(array('a' => ' &#//+%20@۞')), 'a=%20%26%23//%2B%2520%40%DB%9E', 'Value was properly encoded.');
@ -104,7 +104,7 @@ class UrlTest extends WebTestBase {
} }
/** /**
* Test drupal_parse_url(). * Tests drupal_parse_url().
*/ */
function testDrupalParseUrl() { function testDrupalParseUrl() {
// Relative, absolute, and external URLs, without/with explicit script path, // Relative, absolute, and external URLs, without/with explicit script path,
@ -142,8 +142,10 @@ class UrlTest extends WebTestBase {
} }
/** /**
* Test url() with/without query, with/without fragment, absolute on/off and * Tests url() functionality.
* assert all that works when clean URLs are on and off. *
* Tests url() with/without query, with/without fragment, absolute on/off and
* asserts all that works when clean URLs are on and off.
*/ */
function testUrl() { function testUrl() {
global $base_url, $script_path; global $base_url, $script_path;
@ -184,7 +186,7 @@ class UrlTest extends WebTestBase {
} }
/** /**
* Test external URL handling. * Tests external URL handling.
*/ */
function testExternalUrls() { function testExternalUrls() {
$test_url = 'http://drupal.org/'; $test_url = 'http://drupal.org/';

View File

@ -22,7 +22,7 @@ class ValidUrlUnitTest extends UnitTestBase {
} }
/** /**
* Test valid absolute URLs. * Tests valid absolute URLs.
*/ */
function testValidAbsolute() { function testValidAbsolute() {
$url_schemes = array('http', 'https', 'ftp'); $url_schemes = array('http', 'https', 'ftp');
@ -57,7 +57,7 @@ class ValidUrlUnitTest extends UnitTestBase {
} }
/** /**
* Test invalid absolute URLs. * Tests invalid absolute URLs.
*/ */
function testInvalidAbsolute() { function testInvalidAbsolute() {
$url_schemes = array('http', 'https', 'ftp'); $url_schemes = array('http', 'https', 'ftp');
@ -77,7 +77,7 @@ class ValidUrlUnitTest extends UnitTestBase {
} }
/** /**
* Test valid relative URLs. * Tests valid relative URLs.
*/ */
function testValidRelative() { function testValidRelative() {
$valid_relative_urls = array( $valid_relative_urls = array(
@ -98,7 +98,7 @@ class ValidUrlUnitTest extends UnitTestBase {
} }
/** /**
* Test invalid relative URLs. * Tests invalid relative URLs.
*/ */
function testInvalidRelative() { function testInvalidRelative() {
$invalid_relative_urls = array( $invalid_relative_urls = array(

View File

@ -31,7 +31,7 @@ class WriteRecordTest extends WebTestBase {
} }
/** /**
* Test the drupal_write_record() API function. * Tests the drupal_write_record() API function.
*/ */
function testDrupalWriteRecord() { function testDrupalWriteRecord() {
// Insert a record with no columns populated. // Insert a record with no columns populated.

View File

@ -23,7 +23,7 @@ class XssUnitTest extends UnitTestBase {
} }
/** /**
* Check that invalid multi-byte sequences are rejected. * Checks that invalid multi-byte sequences are rejected.
*/ */
function testInvalidMultiByte() { function testInvalidMultiByte() {
// Ignore PHP 5.3+ invalid multibyte sequence warning. // Ignore PHP 5.3+ invalid multibyte sequence warning.
@ -41,7 +41,7 @@ class XssUnitTest extends UnitTestBase {
} }
/** /**
* Check that special characters are escaped. * Checks that special characters are escaped.
*/ */
function testEscaping() { function testEscaping() {
$text = check_plain("<script>"); $text = check_plain("<script>");
@ -51,7 +51,7 @@ class XssUnitTest extends UnitTestBase {
} }
/** /**
* Test t() and format_string() replacement functionality. * Tests t() and format_string() replacement functionality.
*/ */
function testFormatStringAndT() { function testFormatStringAndT() {
foreach (array('format_string', 't') as $function) { foreach (array('format_string', 't') as $function) {
@ -67,7 +67,7 @@ class XssUnitTest extends UnitTestBase {
} }
/** /**
* Check that harmful protocols are stripped. * Checks that harmful protocols are stripped.
*/ */
function testBadProtocolStripping() { function testBadProtocolStripping() {
// Ensure that check_url() strips out harmful protocols, and encodes for // Ensure that check_url() strips out harmful protocols, and encodes for

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Select alter tests. * Tests alter queries.
* *
* @see database_test_query_alter() * @see database_test_query_alter()
*/ */
@ -23,7 +23,7 @@ class AlterTest extends DatabaseTestBase {
} }
/** /**
* Test that we can do basic alters. * Tests that we can do basic alters.
*/ */
function testSimpleAlter() { function testSimpleAlter() {
$query = db_select('test'); $query = db_select('test');
@ -42,7 +42,7 @@ class AlterTest extends DatabaseTestBase {
} }
/** /**
* Test that we can alter the joins on a query. * Tests that we can alter the joins on a query.
*/ */
function testAlterWithJoin() { function testAlterWithJoin() {
$query = db_select('test_task'); $query = db_select('test_task');
@ -66,7 +66,7 @@ class AlterTest extends DatabaseTestBase {
} }
/** /**
* Test that we can alter a query's conditionals. * Tests that we can alter a query's conditionals.
*/ */
function testAlterChangeConditional() { function testAlterChangeConditional() {
$query = db_select('test_task'); $query = db_select('test_task');
@ -91,7 +91,7 @@ class AlterTest extends DatabaseTestBase {
} }
/** /**
* Test that we can alter the fields of a query. * Tests that we can alter the fields of a query.
*/ */
function testAlterChangeFields() { function testAlterChangeFields() {
$query = db_select('test'); $query = db_select('test');
@ -106,7 +106,7 @@ class AlterTest extends DatabaseTestBase {
} }
/** /**
* Test that we can alter expressions in the query. * Tests that we can alter expressions in the query.
*/ */
function testAlterExpression() { function testAlterExpression() {
$query = db_select('test'); $query = db_select('test');
@ -124,7 +124,9 @@ class AlterTest extends DatabaseTestBase {
} }
/** /**
* Test that we can remove a range() value from a query. This also tests hook_query_TAG_alter(). * Tests that we can remove a range() value from a query.
*
* This also tests hook_query_TAG_alter().
*/ */
function testAlterRemoveRange() { function testAlterRemoveRange() {
$query = db_select('test'); $query = db_select('test');
@ -139,7 +141,7 @@ class AlterTest extends DatabaseTestBase {
} }
/** /**
* Test that we can do basic alters on subqueries. * Tests that we can do basic alters on subqueries.
*/ */
function testSimpleAlterSubquery() { function testSimpleAlterSubquery() {
// Create a sub-query with an alter tag. // Create a sub-query with an alter tag.

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Test how the current database driver interprets the SQL syntax. * Tests how the current database driver interprets the SQL syntax.
* *
* In order to ensure consistent SQL handling throughout Drupal * In order to ensure consistent SQL handling throughout Drupal
* across multiple kinds of database systems, we test that the * across multiple kinds of database systems, we test that the
@ -24,7 +24,7 @@ class BasicSyntaxTest extends DatabaseTestBase {
} }
/** /**
* Test for string concatenation. * Tests string concatenation.
*/ */
function testBasicConcat() { function testBasicConcat() {
$result = db_query('SELECT CONCAT(:a1, CONCAT(:a2, CONCAT(:a3, CONCAT(:a4, :a5))))', array( $result = db_query('SELECT CONCAT(:a1, CONCAT(:a2, CONCAT(:a3, CONCAT(:a4, :a5))))', array(
@ -38,7 +38,7 @@ class BasicSyntaxTest extends DatabaseTestBase {
} }
/** /**
* Test for string concatenation with field values. * Tests string concatenation with field values.
*/ */
function testFieldConcat() { function testFieldConcat() {
$result = db_query('SELECT CONCAT(:a1, CONCAT(name, CONCAT(:a2, CONCAT(age, :a3)))) FROM {test} WHERE age = :age', array( $result = db_query('SELECT CONCAT(:a1, CONCAT(name, CONCAT(:a2, CONCAT(age, :a3)))) FROM {test} WHERE age = :age', array(
@ -51,7 +51,7 @@ class BasicSyntaxTest extends DatabaseTestBase {
} }
/** /**
* Test escaping of LIKE wildcards. * Tests escaping of LIKE wildcards.
*/ */
function testLikeEscape() { function testLikeEscape() {
db_insert('test') db_insert('test')
@ -77,7 +77,7 @@ class BasicSyntaxTest extends DatabaseTestBase {
} }
/** /**
* Test LIKE query containing a backslash. * Tests a LIKE query containing a backslash.
*/ */
function testLikeBackslash() { function testLikeBackslash() {
db_insert('test') db_insert('test')

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Test case sensitivity handling. * Tests case sensitivity handling.
*/ */
class CaseSensitivityTest extends DatabaseTestBase { class CaseSensitivityTest extends DatabaseTestBase {
public static function getInfo() { public static function getInfo() {
@ -20,7 +20,7 @@ class CaseSensitivityTest extends DatabaseTestBase {
} }
/** /**
* Test BINARY collation in MySQL. * Tests BINARY collation in MySQL.
*/ */
function testCaseSensitiveInsert() { function testCaseSensitiveInsert() {
$num_records_before = db_query('SELECT COUNT(*) FROM {test}')->fetchField(); $num_records_before = db_query('SELECT COUNT(*) FROM {test}')->fetchField();

View File

@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
use Drupal\Core\Database\Database; use Drupal\Core\Database\Database;
/** /**
* Test connection management. * Tests connection management.
*/ */
class ConnectionTest extends DatabaseTestBase { class ConnectionTest extends DatabaseTestBase {
@ -23,7 +23,7 @@ class ConnectionTest extends DatabaseTestBase {
} }
/** /**
* Test that connections return appropriate connection objects. * Tests that connections return appropriate connection objects.
*/ */
function testConnectionRouting() { function testConnectionRouting() {
// Clone the master credentials to a slave connection. // Clone the master credentials to a slave connection.
@ -57,7 +57,7 @@ class ConnectionTest extends DatabaseTestBase {
} }
/** /**
* Test that connections return appropriate connection objects. * Tests that connections return appropriate connection objects.
*/ */
function testConnectionRoutingOverride() { function testConnectionRoutingOverride() {
// Clone the master credentials to a slave connection. // Clone the master credentials to a slave connection.

View File

@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
* Base test class for databases. * Tests for databases.
* *
* Because all database tests share the same test data, we can centralize that * Because all database tests share the same test data, we can centralize that
* here. * here.
@ -39,7 +39,7 @@ abstract class DatabaseTestBase extends WebTestBase {
} }
/** /**
* Set up several tables needed by a certain test. * Sets up several tables needed by a certain test.
* *
* @param $schema * @param $schema
* An array of table definitions to install. * An array of table definitions to install.
@ -59,7 +59,7 @@ abstract class DatabaseTestBase extends WebTestBase {
} }
/** /**
* Set up tables for NULL handling. * Sets up tables for NULL handling.
*/ */
function ensureSampleDataNull() { function ensureSampleDataNull() {
$schema['test_null'] = drupal_get_schema('test_null'); $schema['test_null'] = drupal_get_schema('test_null');
@ -83,7 +83,7 @@ abstract class DatabaseTestBase extends WebTestBase {
} }
/** /**
* Setup our sample data. * Sets up our sample data.
* *
* These are added using db_query(), since we're not trying to test the * These are added using db_query(), since we're not trying to test the
* INSERT operations here, just populate. * INSERT operations here, just populate.

View File

@ -29,7 +29,7 @@ class DeleteTruncateTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can use a subselect in a delete successfully. * Confirms that we can use a subselect in a delete successfully.
*/ */
function testSubselectDelete() { function testSubselectDelete() {
$num_records_before = db_query('SELECT COUNT(*) FROM {test_task}')->fetchField(); $num_records_before = db_query('SELECT COUNT(*) FROM {test_task}')->fetchField();
@ -50,7 +50,7 @@ class DeleteTruncateTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can delete a single record successfully. * Confirms that we can delete a single record successfully.
*/ */
function testSimpleDelete() { function testSimpleDelete() {
$num_records_before = db_query('SELECT COUNT(*) FROM {test}')->fetchField(); $num_records_before = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
@ -65,7 +65,7 @@ class DeleteTruncateTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can truncate a whole table successfully. * Confirms that we can truncate a whole table successfully.
*/ */
function testTruncate() { function testTruncate() {
$num_records_before = db_query("SELECT COUNT(*) FROM {test}")->fetchField(); $num_records_before = db_query("SELECT COUNT(*) FROM {test}")->fetchField();

View File

@ -24,7 +24,7 @@ class EmptyStatementTest extends WebTestBase {
} }
/** /**
* Test that the empty result set behaves as empty. * Tests that the empty result set behaves as empty.
*/ */
function testEmpty() { function testEmpty() {
$result = new StatementEmpty(); $result = new StatementEmpty();
@ -34,7 +34,7 @@ class EmptyStatementTest extends WebTestBase {
} }
/** /**
* Test that the empty result set iterates safely. * Tests that the empty result set iterates safely.
*/ */
function testEmptyIteration() { function testEmptyIteration() {
$result = new StatementEmpty(); $result = new StatementEmpty();
@ -48,7 +48,7 @@ class EmptyStatementTest extends WebTestBase {
} }
/** /**
* Test that the empty result set mass-fetches in an expected way. * Tests that the empty result set mass-fetches in an expected way.
*/ */
function testEmptyFetchAll() { function testEmptyFetchAll() {
$result = new StatementEmpty(); $result = new StatementEmpty();

View File

@ -7,9 +7,8 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Dummy class for fetching into a class. * Fetches into a class.
* *
* PDO supports using a new instance of an arbitrary class for records * PDO supports using a new instance of an arbitrary class for records
* rather than just a stdClass or array. This class is for testing that * rather than just a stdClass or array. This class is for testing that

View File

@ -11,7 +11,7 @@ use Drupal\Core\Database\StatementInterface;
use PDO; use PDO;
/** /**
* Test fetch actions, part 1. * Tests fetch actions.
* *
* We get timeout errors if we try to run too many tests at once. * We get timeout errors if we try to run too many tests at once.
*/ */
@ -26,7 +26,7 @@ class FetchTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can fetch a record properly in default object mode. * Confirms that we can fetch a record properly in default object mode.
*/ */
function testQueryFetchDefault() { function testQueryFetchDefault() {
$records = array(); $records = array();
@ -42,7 +42,7 @@ class FetchTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can fetch a record to an object explicitly. * Confirms that we can fetch a record to an object explicitly.
*/ */
function testQueryFetchObject() { function testQueryFetchObject() {
$records = array(); $records = array();
@ -57,7 +57,7 @@ class FetchTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can fetch a record to an array associative explicitly. * Confirms that we can fetch a record to an associative array explicitly.
*/ */
function testQueryFetchArray() { function testQueryFetchArray() {
$records = array(); $records = array();
@ -73,7 +73,7 @@ class FetchTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can fetch a record into a new instance of a custom class. * Confirms that we can fetch a record into a new instance of a custom class.
* *
* @see Drupal\system\Tests\Database\FakeRecord * @see Drupal\system\Tests\Database\FakeRecord
*/ */
@ -90,7 +90,9 @@ class FetchTest extends DatabaseTestBase {
$this->assertIdentical(count($records), 1, 'There is only one record.'); $this->assertIdentical(count($records), 1, 'There is only one record.');
} }
// Confirm that we can fetch a record into an indexed array explicitly. /**
* Confirms that we can fetch a record into an indexed array explicitly.
*/
function testQueryFetchNum() { function testQueryFetchNum() {
$records = array(); $records = array();
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_NUM)); $result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_NUM));
@ -105,7 +107,7 @@ class FetchTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can fetch a record into a doubly-keyed array explicitly. * Confirms that we can fetch a record into a doubly-keyed array explicitly.
*/ */
function testQueryFetchBoth() { function testQueryFetchBoth() {
$records = array(); $records = array();
@ -122,7 +124,7 @@ class FetchTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can fetch an entire column of a result set at once. * Confirms that we can fetch an entire column of a result set at once.
*/ */
function testQueryFetchCol() { function testQueryFetchCol() {
$records = array(); $records = array();

View File

@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
use Drupal\Core\Database\Query\NoFieldsException; use Drupal\Core\Database\Query\NoFieldsException;
/** /**
* Insert tests for "database default" values. * Tests insertion for database default values.
*/ */
class InsertDefaultsTest extends DatabaseTestBase { class InsertDefaultsTest extends DatabaseTestBase {
@ -23,7 +23,7 @@ class InsertDefaultsTest extends DatabaseTestBase {
} }
/** /**
* Test that we can run a query that is "default values for everything". * Tests that we can run a query that uses default values for everything.
*/ */
function testDefaultInsert() { function testDefaultInsert() {
$query = db_insert('test')->useDefaults(array('job')); $query = db_insert('test')->useDefaults(array('job'));
@ -36,7 +36,7 @@ class InsertDefaultsTest extends DatabaseTestBase {
} }
/** /**
* Test that no action will be preformed if no fields are specified. * Tests that no action will be preformed if no fields are specified.
*/ */
function testDefaultEmptyInsert() { function testDefaultEmptyInsert() {
$num_records_before = (int) db_query('SELECT COUNT(*) FROM {test}')->fetchField(); $num_records_before = (int) db_query('SELECT COUNT(*) FROM {test}')->fetchField();
@ -54,7 +54,7 @@ class InsertDefaultsTest extends DatabaseTestBase {
} }
/** /**
* Test that we can insert fields with values and defaults in the same query. * Tests that we can insert fields with values and defaults in the same query.
*/ */
function testDefaultInsertWithFields() { function testDefaultInsertWithFields() {
$query = db_insert('test') $query = db_insert('test')

View File

@ -21,7 +21,7 @@ class InsertLobTest extends DatabaseTestBase {
} }
/** /**
* Test that we can insert a single blob field successfully. * Tests that we can insert a single blob field successfully.
*/ */
function testInsertOneBlob() { function testInsertOneBlob() {
$data = "This is\000a test."; $data = "This is\000a test.";
@ -34,7 +34,7 @@ class InsertLobTest extends DatabaseTestBase {
} }
/** /**
* Test that we can insert multiple blob fields in the same query. * Tests that we can insert multiple blob fields in the same query.
*/ */
function testInsertMultipleBlob() { function testInsertMultipleBlob() {
$id = db_insert('test_two_blobs') $id = db_insert('test_two_blobs')

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Test the insert builder. * Tests the insert builder.
*/ */
class InsertTest extends DatabaseTestBase { class InsertTest extends DatabaseTestBase {
@ -21,7 +21,7 @@ class InsertTest extends DatabaseTestBase {
} }
/** /**
* Test the very basic insert functionality. * Tests very basic insert functionality.
*/ */
function testSimpleInsert() { function testSimpleInsert() {
$num_records_before = db_query('SELECT COUNT(*) FROM {test}')->fetchField(); $num_records_before = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
@ -40,7 +40,7 @@ class InsertTest extends DatabaseTestBase {
} }
/** /**
* Test that we can insert multiple records in one query object. * Tests that we can insert multiple records in one query object.
*/ */
function testMultiInsert() { function testMultiInsert() {
$num_records_before = (int) db_query('SELECT COUNT(*) FROM {test}')->fetchField(); $num_records_before = (int) db_query('SELECT COUNT(*) FROM {test}')->fetchField();
@ -73,7 +73,7 @@ class InsertTest extends DatabaseTestBase {
} }
/** /**
* Test that an insert object can be reused with new data after it executes. * Tests that an insert object can be reused with new data after it executes.
*/ */
function testRepeatedInsert() { function testRepeatedInsert() {
$num_records_before = db_query('SELECT COUNT(*) FROM {test}')->fetchField(); $num_records_before = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
@ -108,7 +108,7 @@ class InsertTest extends DatabaseTestBase {
} }
/** /**
* Test that we can specify fields without values and specify values later. * Tests that we can specify fields without values and specify values later.
*/ */
function testInsertFieldOnlyDefinintion() { function testInsertFieldOnlyDefinintion() {
// This is useful for importers, when we want to create a query and define // This is useful for importers, when we want to create a query and define
@ -142,7 +142,7 @@ class InsertTest extends DatabaseTestBase {
} }
/** /**
* Test that the INSERT INTO ... SELECT ... syntax works. * Tests that the INSERT INTO ... SELECT ... syntax works.
*/ */
function testInsertSelect() { function testInsertSelect() {
$query = db_select('test_people', 'tp'); $query = db_select('test_people', 'tp');

View File

@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
use Exception; use Exception;
/** /**
* Test invalid data handling. * Tests invalid data handling.
*/ */
class InvalidDataTest extends DatabaseTestBase { class InvalidDataTest extends DatabaseTestBase {
public static function getInfo() { public static function getInfo() {
@ -22,7 +22,7 @@ class InvalidDataTest extends DatabaseTestBase {
} }
/** /**
* Traditional SQL database systems abort inserts when invalid data is encountered. * Tests aborting of traditional SQL database systems with invalid data.
*/ */
function testInsertDuplicateData() { function testInsertDuplicateData() {
// Try to insert multiple records where at least one has bad data. // Try to insert multiple records where at least one has bad data.

View File

@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
use Drupal\Core\Database\Database; use Drupal\Core\Database\Database;
/** /**
* Query logging tests. * Tests query logging.
*/ */
class LoggingTest extends DatabaseTestBase { class LoggingTest extends DatabaseTestBase {
@ -23,7 +23,7 @@ class LoggingTest extends DatabaseTestBase {
} }
/** /**
* Test that we can log the existence of a query. * Tests that we can log the existence of a query.
*/ */
function testEnableLogging() { function testEnableLogging() {
$log = Database::startLog('testing'); $log = Database::startLog('testing');
@ -44,7 +44,7 @@ class LoggingTest extends DatabaseTestBase {
} }
/** /**
* Test that we can run two logs in parallel. * Tests that we can run two logs in parallel.
*/ */
function testEnableMultiLogging() { function testEnableMultiLogging() {
Database::startLog('testing1'); Database::startLog('testing1');
@ -63,7 +63,7 @@ class LoggingTest extends DatabaseTestBase {
} }
/** /**
* Test that we can log queries against multiple targets on the same connection. * Tests logging queries against multiple targets on the same connection.
*/ */
function testEnableTargetLogging() { function testEnableTargetLogging() {
// Clone the master credentials to a slave connection and to another fake // Clone the master credentials to a slave connection and to another fake
@ -85,7 +85,7 @@ class LoggingTest extends DatabaseTestBase {
} }
/** /**
* Test that logs to separate targets collapse to the same connection properly. * Tests that logs to separate targets utilize the same connection properly.
* *
* This test is identical to the one above, except that it doesn't create * This test is identical to the one above, except that it doesn't create
* a fake target so the query should fall back to running on the default * a fake target so the query should fall back to running on the default
@ -111,7 +111,7 @@ class LoggingTest extends DatabaseTestBase {
} }
/** /**
* Test that we can log queries separately on different connections. * Tests that we can log queries separately on different connections.
*/ */
function testEnableMultiConnectionLogging() { function testEnableMultiConnectionLogging() {
// Clone the master credentials to a fake connection. // Clone the master credentials to a fake connection.

View File

@ -11,7 +11,7 @@ use Drupal\Core\Database\Query\Merge;
use Drupal\Core\Database\Query\InvalidMergeQueryException; use Drupal\Core\Database\Query\InvalidMergeQueryException;
/** /**
* Test the MERGE query builder. * Tests the MERGE query builder.
*/ */
class MergeTest extends DatabaseTestBase { class MergeTest extends DatabaseTestBase {
@ -24,7 +24,7 @@ class MergeTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can merge-insert a record successfully. * Confirms that we can merge-insert a record successfully.
*/ */
function testMergeInsert() { function testMergeInsert() {
$num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
@ -49,7 +49,7 @@ class MergeTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can merge-update a record successfully. * Confirms that we can merge-update a record successfully.
*/ */
function testMergeUpdate() { function testMergeUpdate() {
$num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
@ -74,7 +74,10 @@ class MergeTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can merge-update a record successfully, with different insert and update. * Confirms that we can merge-update a record successfully.
*
* This test varies from the previous test because it manually defines which
* fields are inserted, and which fields are updated.
*/ */
function testMergeUpdateExcept() { function testMergeUpdateExcept() {
$num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
@ -95,7 +98,7 @@ class MergeTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can merge-update a record successfully, with alternate replacement. * Confirms that we can merge-update a record successfully, with alternate replacement.
*/ */
function testMergeUpdateExplicit() { function testMergeUpdateExplicit() {
$num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
@ -121,7 +124,7 @@ class MergeTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can merge-update a record successfully, with expressions. * Confirms that we can merge-update a record successfully, with expressions.
*/ */
function testMergeUpdateExpression() { function testMergeUpdateExpression() {
$num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
@ -150,7 +153,7 @@ class MergeTest extends DatabaseTestBase {
} }
/** /**
* Test that we can merge-insert without any update fields. * Tests that we can merge-insert without any update fields.
*/ */
function testMergeInsertWithoutUpdate() { function testMergeInsertWithoutUpdate() {
$num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
@ -169,7 +172,7 @@ class MergeTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can merge-update without any update fields. * Confirms that we can merge-update without any update fields.
*/ */
function testMergeUpdateWithoutUpdate() { function testMergeUpdateWithoutUpdate() {
$num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField(); $num_records_before = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
@ -201,7 +204,7 @@ class MergeTest extends DatabaseTestBase {
} }
/** /**
* Test that an invalid merge query throws an exception like it is supposed to. * Tests that an invalid merge query throws an exception.
*/ */
function testInvalidMerge() { function testInvalidMerge() {
try { try {

View File

@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
* Check the sequences API. * Checks the sequences API.
*/ */
class NextIdTest extends WebTestBase { class NextIdTest extends WebTestBase {
public static function getInfo() { public static function getInfo() {
@ -22,7 +22,7 @@ class NextIdTest extends WebTestBase {
} }
/** /**
* Test that the sequences API work. * Tests that the sequences API works.
*/ */
function testDbNextId() { function testDbNextId() {
$first = db_next_id(); $first = db_next_id();

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Drupal-specific SQL syntax tests. * Tests Drupal-specific SQL syntax tests.
*/ */
class QueryTest extends DatabaseTestBase { class QueryTest extends DatabaseTestBase {
public static function getInfo() { public static function getInfo() {
@ -20,7 +20,7 @@ class QueryTest extends DatabaseTestBase {
} }
/** /**
* Test that we can specify an array of values in the query by simply passing in an array. * Tests that we can pass an array of values directly in the query.
*/ */
function testArraySubstitution() { function testArraySubstitution() {
$names = db_query('SELECT name FROM {test} WHERE age IN (:ages) ORDER BY age', array(':ages' => array(25, 26, 27)))->fetchAll(); $names = db_query('SELECT name FROM {test} WHERE age IN (:ages) ORDER BY age', array(':ages' => array(25, 26, 27)))->fetchAll();

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Range query tests. * Tests range queries.
*/ */
class RangeQueryTest extends DatabaseTestBase { class RangeQueryTest extends DatabaseTestBase {
@ -28,7 +28,7 @@ class RangeQueryTest extends DatabaseTestBase {
} }
/** /**
* Confirm that range query work and return correct result. * Confirms that range queries work and return the correct result.
*/ */
function testRangeQuery() { function testRangeQuery() {
// Test if return correct number of rows. // Test if return correct number of rows.

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Regression tests. * Tests for database regressions.
*/ */
class RegressionTest extends DatabaseTestBase { class RegressionTest extends DatabaseTestBase {
@ -28,10 +28,7 @@ class RegressionTest extends DatabaseTestBase {
} }
/** /**
* Regression test for #310447. * Ensures that non-ASCII UTF-8 data is stored in the database properly.
*
* Tries to insert non-ascii UTF-8 data in a database column and checks
* if its stored properly.
*/ */
function testRegression_310447() { function testRegression_310447() {
// That's a 255 character UTF-8 string. // That's a 255 character UTF-8 string.
@ -48,7 +45,7 @@ class RegressionTest extends DatabaseTestBase {
} }
/** /**
* Test the db_table_exists() function. * Tests the db_table_exists() function.
*/ */
function testDBTableExists() { function testDBTableExists() {
$this->assertIdentical(TRUE, db_table_exists('node'), 'Returns true for existent table.'); $this->assertIdentical(TRUE, db_table_exists('node'), 'Returns true for existent table.');
@ -56,7 +53,7 @@ class RegressionTest extends DatabaseTestBase {
} }
/** /**
* Test the db_field_exists() function. * Tests the db_field_exists() function.
*/ */
function testDBFieldExists() { function testDBFieldExists() {
$this->assertIdentical(TRUE, db_field_exists('node', 'nid'), 'Returns true for existent column.'); $this->assertIdentical(TRUE, db_field_exists('node', 'nid'), 'Returns true for existent column.');
@ -64,7 +61,7 @@ class RegressionTest extends DatabaseTestBase {
} }
/** /**
* Test the db_index_exists() function. * Tests the db_index_exists() function.
*/ */
function testDBIndexExists() { function testDBIndexExists() {
$this->assertIdentical(TRUE, db_index_exists('node', 'node_created'), 'Returns true for existent index.'); $this->assertIdentical(TRUE, db_index_exists('node', 'node_created'), 'Returns true for existent index.');

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Test more complex select statements. * Tests more complex select statements.
*/ */
class SelectComplexTest extends DatabaseTestBase { class SelectComplexTest extends DatabaseTestBase {
@ -28,7 +28,7 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Test simple JOIN statements. * Tests simple JOIN statements.
*/ */
function testDefaultJoin() { function testDefaultJoin() {
$query = db_select('test_task', 't'); $query = db_select('test_task', 't');
@ -53,7 +53,7 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Test LEFT OUTER joins. * Tests LEFT OUTER joins.
*/ */
function testLeftOuterJoin() { function testLeftOuterJoin() {
$query = db_select('test', 'p'); $query = db_select('test', 'p');
@ -78,7 +78,7 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Test GROUP BY clauses. * Tests GROUP BY clauses.
*/ */
function testGroupBy() { function testGroupBy() {
$query = db_select('test_task', 't'); $query = db_select('test_task', 't');
@ -114,7 +114,7 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Test GROUP BY and HAVING clauses together. * Tests GROUP BY and HAVING clauses together.
*/ */
function testGroupByAndHaving() { function testGroupByAndHaving() {
$query = db_select('test_task', 't'); $query = db_select('test_task', 't');
@ -148,7 +148,9 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Test range queries. The SQL clause varies with the database. * Tests range queries.
*
* The SQL clause varies with the database.
*/ */
function testRange() { function testRange() {
$query = db_select('test'); $query = db_select('test');
@ -166,7 +168,7 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Test distinct queries. * Tests distinct queries.
*/ */
function testDistinct() { function testDistinct() {
$query = db_select('test_task'); $query = db_select('test_task');
@ -183,7 +185,7 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Test that we can generate a count query from a built query. * Tests that we can generate a count query from a built query.
*/ */
function testCountQuery() { function testCountQuery() {
$query = db_select('test'); $query = db_select('test');
@ -214,8 +216,7 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Test that countQuery properly removes 'all_fields' statements and * Tests that countQuery removes 'all_fields' statements and ordering clauses.
* ordering clauses.
*/ */
function testCountQueryRemovals() { function testCountQueryRemovals() {
$query = db_select('test'); $query = db_select('test');
@ -243,7 +244,7 @@ class SelectComplexTest extends DatabaseTestBase {
/** /**
* Test that countQuery properly removes fields and expressions. * Tests that countQuery properly removes fields and expressions.
*/ */
function testCountQueryFieldRemovals() { function testCountQueryFieldRemovals() {
// countQuery should remove all fields and expressions, so this can be // countQuery should remove all fields and expressions, so this can be
@ -261,7 +262,7 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Test that we can generate a count query from a query with distinct. * Tests that we can generate a count query from a query with distinct.
*/ */
function testCountQueryDistinct() { function testCountQueryDistinct() {
$query = db_select('test_task'); $query = db_select('test_task');
@ -274,7 +275,7 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Test that we can generate a count query from a query with GROUP BY. * Tests that we can generate a count query from a query with GROUP BY.
*/ */
function testCountQueryGroupBy() { function testCountQueryGroupBy() {
$query = db_select('test_task'); $query = db_select('test_task');
@ -299,7 +300,7 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can properly nest conditional clauses. * Confirms that we can properly nest conditional clauses.
*/ */
function testNestedConditions() { function testNestedConditions() {
// This query should translate to: // This query should translate to:
@ -316,7 +317,7 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Confirm we can join on a single table twice with a dynamic alias. * Confirms we can join on a single table twice with a dynamic alias.
*/ */
function testJoinTwice() { function testJoinTwice() {
$query = db_select('test')->fields('test'); $query = db_select('test')->fields('test');
@ -330,7 +331,7 @@ class SelectComplexTest extends DatabaseTestBase {
} }
/** /**
* Test that we can join on a query. * Tests that we can join on a query.
*/ */
function testJoinSubquery() { function testJoinSubquery() {
$acct = $this->drupalCreateUser(); $acct = $this->drupalCreateUser();

View File

@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
use PDO; use PDO;
/** /**
* Test select with order by clauses. * Tests SELECT with ORDER BY clauses.
*/ */
class SelectOrderedTest extends DatabaseTestBase { class SelectOrderedTest extends DatabaseTestBase {
@ -23,7 +23,7 @@ class SelectOrderedTest extends DatabaseTestBase {
} }
/** /**
* Test basic order by. * Tests basic ORDER BY.
*/ */
function testSimpleSelectOrdered() { function testSimpleSelectOrdered() {
$query = db_select('test'); $query = db_select('test');
@ -44,7 +44,7 @@ class SelectOrderedTest extends DatabaseTestBase {
} }
/** /**
* Test multiple order by. * Tests multiple ORDER BY.
*/ */
function testSimpleSelectMultiOrdered() { function testSimpleSelectMultiOrdered() {
$query = db_select('test'); $query = db_select('test');
@ -75,7 +75,7 @@ class SelectOrderedTest extends DatabaseTestBase {
} }
/** /**
* Test order by descending. * Tests ORDER BY descending.
*/ */
function testSimpleSelectOrderedDesc() { function testSimpleSelectOrderedDesc() {
$query = db_select('test'); $query = db_select('test');

View File

@ -21,7 +21,7 @@ class SelectPagerDefaultTest extends DatabaseTestBase {
} }
/** /**
* Confirm that a pager query returns the correct results. * Confirms that a pager query returns the correct results.
* *
* Note that we have to make an HTTP request to a test page handler * Note that we have to make an HTTP request to a test page handler
* because the pager depends on GET parameters. * because the pager depends on GET parameters.
@ -55,7 +55,7 @@ class SelectPagerDefaultTest extends DatabaseTestBase {
} }
/** /**
* Confirm that a pager query returns the correct results. * Confirms that a pager query returns the correct results.
* *
* Note that we have to make an HTTP request to a test page handler * Note that we have to make an HTTP request to a test page handler
* because the pager depends on GET parameters. * because the pager depends on GET parameters.
@ -89,7 +89,7 @@ class SelectPagerDefaultTest extends DatabaseTestBase {
} }
/** /**
* Confirm that a pager query with inner pager query returns valid results. * Confirms that a pager query results with an inner pager query are valid.
* *
* This is a regression test for #467984. * This is a regression test for #467984.
*/ */
@ -111,7 +111,7 @@ class SelectPagerDefaultTest extends DatabaseTestBase {
} }
/** /**
* Confirm that a paging query with a having expression returns valid results. * Confirms that a paging query results with a having expression are valid.
* *
* This is a regression test for #467984. * This is a regression test for #467984.
*/ */
@ -132,7 +132,7 @@ class SelectPagerDefaultTest extends DatabaseTestBase {
} }
/** /**
* Confirm that every pager gets a valid non-overlaping element ID. * Confirms that every pager gets a valid, non-overlaping element ID.
*/ */
function testElementNumbers() { function testElementNumbers() {
$_GET['page'] = '3, 2, 1, 0'; $_GET['page'] = '3, 2, 1, 0';

View File

@ -21,7 +21,7 @@ class SelectSubqueryTest extends DatabaseTestBase {
} }
/** /**
* Test that we can use a subquery in a FROM clause. * Tests that we can use a subquery in a FROM clause.
*/ */
function testFromSubquerySelect() { function testFromSubquerySelect() {
// Create a subquery, which is just a normal query object. // Create a subquery, which is just a normal query object.
@ -55,7 +55,7 @@ class SelectSubqueryTest extends DatabaseTestBase {
} }
/** /**
* Test that we can use a subquery in a FROM clause with a limit. * Tests that we can use a subquery in a FROM clause with a LIMIT.
*/ */
function testFromSubquerySelectWithLimit() { function testFromSubquerySelectWithLimit() {
// Create a subquery, which is just a normal query object. // Create a subquery, which is just a normal query object.
@ -81,7 +81,7 @@ class SelectSubqueryTest extends DatabaseTestBase {
} }
/** /**
* Test that we can use a subquery in a WHERE clause. * Tests that we can use a subquery in a WHERE clause.
*/ */
function testConditionSubquerySelect() { function testConditionSubquerySelect() {
// Create a subquery, which is just a normal query object. // Create a subquery, which is just a normal query object.
@ -104,7 +104,7 @@ class SelectSubqueryTest extends DatabaseTestBase {
} }
/** /**
* Test that we can use a subquery in a JOIN clause. * Tests that we can use a subquery in a JOIN clause.
*/ */
function testJoinSubquerySelect() { function testJoinSubquerySelect() {
// Create a subquery, which is just a normal query object. // Create a subquery, which is just a normal query object.
@ -128,7 +128,7 @@ class SelectSubqueryTest extends DatabaseTestBase {
} }
/** /**
* Test EXISTS subquery conditionals on SELECT statements. * Tests EXISTS subquery conditionals on SELECT statements.
* *
* We essentially select all rows from the {test} table that have matching * We essentially select all rows from the {test} table that have matching
* rows in the {test_people} table based on the shared name column. * rows in the {test_people} table based on the shared name column.
@ -158,7 +158,7 @@ class SelectSubqueryTest extends DatabaseTestBase {
} }
/** /**
* Test NOT EXISTS subquery conditionals on SELECT statements. * Tests NOT EXISTS subquery conditionals on SELECT statements.
* *
* We essentially select all rows from the {test} table that don't have * 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. * matching rows in the {test_people} table based on the shared name column.

View File

@ -21,7 +21,7 @@ class SelectTableSortDefaultTest extends DatabaseTestBase {
} }
/** /**
* Confirm that a tablesort query returns the correct results. * Confirms that a tablesort query returns the correct results.
* *
* Note that we have to make an HTTP request to a test page handler * Note that we have to make an HTTP request to a test page handler
* because the pager depends on GET parameters. * because the pager depends on GET parameters.
@ -49,8 +49,10 @@ class SelectTableSortDefaultTest extends DatabaseTestBase {
} }
/** /**
* Confirm that if a tablesort's orderByHeader is called before another orderBy, that the header happens first. * Confirms precedence of tablesorts headers.
* *
* If a tablesort's orderByHeader is called before another orderBy, then its
* header happens first.
*/ */
function testTableSortQueryFirst() { function testTableSortQueryFirst() {
$sorts = array( $sorts = array(
@ -75,7 +77,7 @@ class SelectTableSortDefaultTest extends DatabaseTestBase {
} }
/** /**
* Confirm that if a sort is not set in a tableselect form there is no error thrown when using the default. * Confirms that no error is thrown if a sort is not set in a default tableselect.
*/ */
function testTableSortDefaultSort() { function testTableSortDefaultSort() {
$this->drupalGet('database_test/tablesort_default_sort'); $this->drupalGet('database_test/tablesort_default_sort');

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Test the SELECT builder. * Tests the SELECT builder.
*/ */
class SelectTest extends DatabaseTestBase { class SelectTest extends DatabaseTestBase {
@ -21,7 +21,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test rudimentary SELECT statements. * Tests rudimentary SELECT statements.
*/ */
function testSimpleSelect() { function testSimpleSelect() {
$query = db_select('test'); $query = db_select('test');
@ -38,7 +38,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test rudimentary SELECT statement with a COMMENT. * Tests rudimentary SELECT statement with a COMMENT.
*/ */
function testSimpleComment() { function testSimpleComment() {
$query = db_select('test')->comment('Testing query comments'); $query = db_select('test')->comment('Testing query comments');
@ -59,7 +59,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test query COMMENT system against vulnerabilities. * Tests query COMMENT system against vulnerabilities.
*/ */
function testVulnerableComment() { function testVulnerableComment() {
$query = db_select('test')->comment('Testing query comments */ SELECT nid FROM {node}; --'); $query = db_select('test')->comment('Testing query comments */ SELECT nid FROM {node}; --');
@ -80,7 +80,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test basic conditionals on SELECT statements. * Tests basic conditionals on SELECT statements.
*/ */
function testSimpleSelectConditional() { function testSimpleSelectConditional() {
$query = db_select('test'); $query = db_select('test');
@ -100,7 +100,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test SELECT statements with expressions. * Tests SELECT statements with expressions.
*/ */
function testSimpleSelectExpression() { function testSimpleSelectExpression() {
$query = db_select('test'); $query = db_select('test');
@ -120,7 +120,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test SELECT statements with multiple expressions. * Tests SELECT statements with multiple expressions.
*/ */
function testSimpleSelectExpressionMultiple() { function testSimpleSelectExpressionMultiple() {
$query = db_select('test'); $query = db_select('test');
@ -142,7 +142,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test adding multiple fields to a select statement at the same time. * Tests adding multiple fields to a SELECT statement at the same time.
*/ */
function testSimpleSelectMultipleFields() { function testSimpleSelectMultipleFields() {
$record = db_select('test') $record = db_select('test')
@ -165,7 +165,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test adding all fields from a given table to a select statement. * Tests adding all fields from a given table to a SELECT statement.
*/ */
function testSimpleSelectAllFields() { function testSimpleSelectAllFields() {
$record = db_select('test') $record = db_select('test')
@ -188,7 +188,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test that a comparison with NULL is always FALSE. * Tests that a comparison with NULL is always FALSE.
*/ */
function testNullCondition() { function testNullCondition() {
$this->ensureSampleDataNull(); $this->ensureSampleDataNull();
@ -202,7 +202,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test that we can find a record with a NULL value. * Tests that we can find a record with a NULL value.
*/ */
function testIsNullCondition() { function testIsNullCondition() {
$this->ensureSampleDataNull(); $this->ensureSampleDataNull();
@ -217,7 +217,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test that we can find a record without a NULL value. * Tests that we can find a record without a NULL value.
*/ */
function testIsNotNullCondition() { function testIsNotNullCondition() {
$this->ensureSampleDataNull(); $this->ensureSampleDataNull();
@ -234,8 +234,10 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test that we can UNION multiple Select queries together. This is * Tests that we can UNION multiple Select queries together.
* semantically equal to UNION DISTINCT, so we don't explicity test that. *
* This is semantically equal to UNION DISTINCT, so we don't explicity test
* that.
*/ */
function testUnion() { function testUnion() {
$query_1 = db_select('test', 't') $query_1 = db_select('test', 't')
@ -258,7 +260,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test that we can UNION ALL multiple Select queries together. * Tests that we can UNION ALL multiple SELECT queries together.
*/ */
function testUnionAll() { function testUnionAll() {
$query_1 = db_select('test', 't') $query_1 = db_select('test', 't')
@ -304,7 +306,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test that random ordering of queries works. * Tests that random ordering of queries works.
* *
* We take the approach of testing the Drupal layer only, rather than trying * We take the approach of testing the Drupal layer only, rather than trying
* to test that the database's random number generator actually produces * to test that the database's random number generator actually produces
@ -366,7 +368,7 @@ class SelectTest extends DatabaseTestBase {
} }
/** /**
* Test that aliases are renamed when duplicates. * Tests that aliases are renamed when duplicates.
*/ */
function testSelectDuplicateAlias() { function testSelectDuplicateAlias() {
$query = db_select('test', 't'); $query = db_select('test', 't');

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Query serialization tests. * Tests query serialization.
*/ */
class SerializeQueryTest extends DatabaseTestBase { class SerializeQueryTest extends DatabaseTestBase {
public static function getInfo() { public static function getInfo() {
@ -20,7 +20,7 @@ class SerializeQueryTest extends DatabaseTestBase {
} }
/** /**
* Confirm that a query can be serialized and unserialized. * Confirms that a query can be serialized and unserialized.
*/ */
function testSerializeQuery() { function testSerializeQuery() {
$query = db_select('test'); $query = db_select('test');

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Select tagging tests. * Tests SELECT query tagging.
* *
* Tags are a way to flag queries for alter hooks so they know * Tags are a way to flag queries for alter hooks so they know
* what type of query it is, such as "node_access". * what type of query it is, such as "node_access".
@ -24,7 +24,7 @@ class TaggingTest extends DatabaseTestBase {
} }
/** /**
* Confirm that a query has a "tag" added to it. * Confirms that a query has a tag added to it.
*/ */
function testHasTag() { function testHasTag() {
$query = db_select('test'); $query = db_select('test');
@ -38,7 +38,7 @@ class TaggingTest extends DatabaseTestBase {
} }
/** /**
* Test query tagging "has all of these tags" functionality. * Tests query tagging "has all of these tags" functionality.
*/ */
function testHasAllTags() { function testHasAllTags() {
$query = db_select('test'); $query = db_select('test');
@ -53,7 +53,7 @@ class TaggingTest extends DatabaseTestBase {
} }
/** /**
* Test query tagging "has at least one of these tags" functionality. * Tests query tagging "has at least one of these tags" functionality.
*/ */
function testHasAnyTag() { function testHasAnyTag() {
$query = db_select('test'); $query = db_select('test');
@ -67,7 +67,7 @@ class TaggingTest extends DatabaseTestBase {
} }
/** /**
* Test that we can attach meta data to a query object. * Tests that we can attach metadata to a query object.
* *
* This is how we pass additional context to alter hooks. * This is how we pass additional context to alter hooks.
*/ */

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Temporary query tests. * Tests temporary queries.
*/ */
class TemporaryQueryTest extends DatabaseTestBase { class TemporaryQueryTest extends DatabaseTestBase {
@ -28,14 +28,14 @@ class TemporaryQueryTest extends DatabaseTestBase {
} }
/** /**
* Return the number of rows of a table. * Returns the number of rows of a table.
*/ */
function countTableRows($table_name) { function countTableRows($table_name) {
return db_select($table_name)->countQuery()->execute()->fetchField(); return db_select($table_name)->countQuery()->execute()->fetchField();
} }
/** /**
* Confirm that temporary tables work and are limited to one request. * Confirms that temporary tables work and are limited to one request.
*/ */
function testTemporaryQuery() { function testTemporaryQuery() {
$this->drupalGet('database_test/db_query_temporary'); $this->drupalGet('database_test/db_query_temporary');

View File

@ -13,7 +13,7 @@ use Drupal\Core\Database\TransactionNoActiveException;
use Exception; use Exception;
/** /**
* Test transaction support, particularly nesting. * Tests transaction support, particularly nesting.
* *
* We test nesting by having two transaction layers, an outer and inner. The * We test nesting by having two transaction layers, an outer and inner. The
* outer layer encapsulates the inner layer. Our transaction nesting abstraction * outer layer encapsulates the inner layer. Our transaction nesting abstraction
@ -43,12 +43,14 @@ class TransactionTest extends DatabaseTestBase {
} }
/** /**
* Helper method for transaction unit test. This "outer layer" transaction * Encapsulates a transaction's "inner layer" with an "outer layer".
* starts and then encapsulates the "inner layer" transaction. This nesting *
* is used to evaluate whether the the database transaction API properly * This "outer layer" transaction starts and then encapsulates the "inner
* supports nesting. By "properly supports," we mean the outer transaction * layer" transaction. This nesting is used to evaluate whether the the
* continues to exist regardless of what functions are called and whether * database transaction API properly supports nesting. By "properly supports,"
* those functions start their own transactions. * we mean the outer transaction continues to exist regardless of what
* functions are called and whether those functions start their own
* transactions.
* *
* In contrast, a typical database would commit the outer transaction, start * In contrast, a typical database would commit the outer transaction, start
* a new transaction for the inner layer, commit the inner layer transaction, * a new transaction for the inner layer, commit the inner layer transaction,
@ -93,8 +95,10 @@ class TransactionTest extends DatabaseTestBase {
} }
/** /**
* Helper method for transaction unit tests. This "inner layer" transaction * Creates an "inner layer" transaction.
* is either used alone or nested inside of the "outer layer" transaction. *
* This "inner layer" transaction is either used alone or nested inside of the
* "outer layer" transaction.
* *
* @param $suffix * @param $suffix
* Suffix to add to field values to differentiate tests. * Suffix to add to field values to differentiate tests.
@ -151,9 +155,10 @@ class TransactionTest extends DatabaseTestBase {
} }
/** /**
* Test transaction rollback on a database that supports transactions. * Tests transaction rollback on a database that supports transactions.
* *
* If the active connection does not support transactions, this test does nothing. * If the active connection does not support transactions, this test does
* nothing.
*/ */
function testTransactionRollBackSupported() { function testTransactionRollBackSupported() {
// This test won't work right if transactions are not supported. // This test won't work right if transactions are not supported.
@ -177,7 +182,7 @@ class TransactionTest extends DatabaseTestBase {
} }
/** /**
* Test transaction rollback on a database that does not support transactions. * Tests transaction rollback on a database that doesn't support transactions.
* *
* If the active driver supports transactions, this test does nothing. * If the active driver supports transactions, this test does nothing.
*/ */
@ -203,7 +208,7 @@ class TransactionTest extends DatabaseTestBase {
} }
/** /**
* Test committed transaction. * Tests a committed transaction.
* *
* The behavior of this test should be identical for connections that support * The behavior of this test should be identical for connections that support
* transactions and those that do not. * transactions and those that do not.
@ -225,7 +230,7 @@ class TransactionTest extends DatabaseTestBase {
} }
/** /**
* Test the compatibility of transactions with DDL statements. * Tests the compatibility of transactions with DDL statements.
*/ */
function testTransactionWithDdlStatement() { function testTransactionWithDdlStatement() {
// First, test that a commit works normally, even with DDL statements. // First, test that a commit works normally, even with DDL statements.
@ -316,7 +321,7 @@ class TransactionTest extends DatabaseTestBase {
} }
/** /**
* Insert a single row into the testing table. * Inserts a single row into the testing table.
*/ */
protected function insertRow($name) { protected function insertRow($name) {
db_insert('test') db_insert('test')
@ -327,7 +332,7 @@ class TransactionTest extends DatabaseTestBase {
} }
/** /**
* Execute a DDL statement. * Executes a DDL statement.
*/ */
protected function executeDDLStatement() { protected function executeDDLStatement() {
static $count = 0; static $count = 0;
@ -345,7 +350,7 @@ class TransactionTest extends DatabaseTestBase {
} }
/** /**
* Start over for a new test. * Starts over for a new test.
*/ */
protected function cleanUp() { protected function cleanUp() {
db_truncate('test') db_truncate('test')
@ -353,7 +358,7 @@ class TransactionTest extends DatabaseTestBase {
} }
/** /**
* Assert that a given row is present in the test table. * Asserts that a given row is present in the test table.
* *
* @param $name * @param $name
* The name of the row. * The name of the row.
@ -369,7 +374,7 @@ class TransactionTest extends DatabaseTestBase {
} }
/** /**
* Assert that a given row is absent from the test table. * Asserts that a given row is absent from the test table.
* *
* @param $name * @param $name
* The name of the row. * The name of the row.
@ -385,7 +390,7 @@ class TransactionTest extends DatabaseTestBase {
} }
/** /**
* Test transaction stacking and commit / rollback. * Tests transaction stacking, commit, and rollback.
*/ */
function testTransactionStacking() { function testTransactionStacking() {
// This test won't work right if transactions are not supported. // This test won't work right if transactions are not supported.

View File

@ -21,7 +21,7 @@ class UpdateComplexTest extends DatabaseTestBase {
} }
/** /**
* Test updates with OR conditionals. * Tests updates with OR conditionals.
*/ */
function testOrConditionUpdate() { function testOrConditionUpdate() {
$update = db_update('test') $update = db_update('test')
@ -38,7 +38,7 @@ class UpdateComplexTest extends DatabaseTestBase {
} }
/** /**
* Test WHERE IN clauses. * Tests WHERE IN clauses.
*/ */
function testInConditionUpdate() { function testInConditionUpdate() {
$num_updated = db_update('test') $num_updated = db_update('test')
@ -52,7 +52,7 @@ class UpdateComplexTest extends DatabaseTestBase {
} }
/** /**
* Test WHERE NOT IN clauses. * Tests WHERE NOT IN clauses.
*/ */
function testNotInConditionUpdate() { function testNotInConditionUpdate() {
// The o is lowercase in the 'NoT IN' operator, to make sure the operators // The o is lowercase in the 'NoT IN' operator, to make sure the operators
@ -68,7 +68,7 @@ class UpdateComplexTest extends DatabaseTestBase {
} }
/** /**
* Test BETWEEN conditional clauses. * Tests BETWEEN conditional clauses.
*/ */
function testBetweenConditionUpdate() { function testBetweenConditionUpdate() {
$num_updated = db_update('test') $num_updated = db_update('test')
@ -82,7 +82,7 @@ class UpdateComplexTest extends DatabaseTestBase {
} }
/** /**
* Test LIKE conditionals. * Tests LIKE conditionals.
*/ */
function testLikeConditionUpdate() { function testLikeConditionUpdate() {
$num_updated = db_update('test') $num_updated = db_update('test')
@ -96,7 +96,7 @@ class UpdateComplexTest extends DatabaseTestBase {
} }
/** /**
* Test update with expression values. * Tests UPDATE with expression values.
*/ */
function testUpdateExpression() { function testUpdateExpression() {
$before_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'))->fetchField(); $before_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'))->fetchField();
@ -119,7 +119,7 @@ class UpdateComplexTest extends DatabaseTestBase {
} }
/** /**
* Test update with only expression values. * Tests UPDATE with only expression values.
*/ */
function testUpdateOnlyExpression() { function testUpdateOnlyExpression() {
$before_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'))->fetchField(); $before_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'))->fetchField();

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Test update queries involving LOB values. * Tests UPDATE queries involving LOB values.
*/ */
class UpdateLobTest extends DatabaseTestBase { class UpdateLobTest extends DatabaseTestBase {
@ -21,7 +21,7 @@ class UpdateLobTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can update a blob column. * Confirms that we can update a blob column.
*/ */
function testUpdateOneBlob() { function testUpdateOneBlob() {
$data = "This is\000a test."; $data = "This is\000a test.";
@ -41,7 +41,7 @@ class UpdateLobTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can update two blob columns in the same table. * Confirms that we can update two blob columns in the same table.
*/ */
function testUpdateMultipleBlob() { function testUpdateMultipleBlob() {
$id = db_insert('test_two_blobs') $id = db_insert('test_two_blobs')

View File

@ -8,7 +8,7 @@
namespace Drupal\system\Tests\Database; namespace Drupal\system\Tests\Database;
/** /**
* Update builder tests. * Updates builder tests.
*/ */
class UpdateTest extends DatabaseTestBase { class UpdateTest extends DatabaseTestBase {
@ -21,7 +21,7 @@ class UpdateTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can update a single record successfully. * Confirms that we can update a single record successfully.
*/ */
function testSimpleUpdate() { function testSimpleUpdate() {
$num_updated = db_update('test') $num_updated = db_update('test')
@ -35,7 +35,7 @@ class UpdateTest extends DatabaseTestBase {
} }
/** /**
* Confirm updating to NULL. * Confirms updating to NULL.
*/ */
function testSimpleNullUpdate() { function testSimpleNullUpdate() {
$this->ensureSampleDataNull(); $this->ensureSampleDataNull();
@ -50,7 +50,7 @@ class UpdateTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can update a multiple records successfully. * Confirms that we can update multiple records successfully.
*/ */
function testMultiUpdate() { function testMultiUpdate() {
$num_updated = db_update('test') $num_updated = db_update('test')
@ -64,7 +64,7 @@ class UpdateTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can update a multiple records with a non-equality condition. * Confirms that we can update multiple records with a non-equality condition.
*/ */
function testMultiGTUpdate() { function testMultiGTUpdate() {
$num_updated = db_update('test') $num_updated = db_update('test')
@ -78,7 +78,7 @@ class UpdateTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can update a multiple records with a where call. * Confirms that we can update multiple records with a where call.
*/ */
function testWhereUpdate() { function testWhereUpdate() {
$num_updated = db_update('test') $num_updated = db_update('test')
@ -92,7 +92,7 @@ class UpdateTest extends DatabaseTestBase {
} }
/** /**
* Confirm that we can stack condition and where calls. * Confirms that we can stack condition and where calls.
*/ */
function testWhereAndConditionUpdate() { function testWhereAndConditionUpdate() {
$update = db_update('test') $update = db_update('test')
@ -107,7 +107,7 @@ class UpdateTest extends DatabaseTestBase {
} }
/** /**
* Test updating with expressions. * Tests updating with expressions.
*/ */
function testExpressionUpdate() { function testExpressionUpdate() {
// Set age = 1 for a single row for this test to work. // Set age = 1 for a single row for this test to work.

View File

@ -37,9 +37,8 @@ function ajax_forms_test_menu() {
return $items; return $items;
} }
/** /**
* A basic form used to test form_state['values'] during callback. * Tests form_state['values'] during callback.
*/ */
function ajax_forms_test_simple_form($form, &$form_state) { function ajax_forms_test_simple_form($form, &$form_state) {
$form = array(); $form = array();
@ -71,7 +70,7 @@ function ajax_forms_test_simple_form($form, &$form_state) {
} }
/** /**
* Ajax callback triggered by select. * Ajax form callback: Selects color.
*/ */
function ajax_forms_test_simple_form_select_callback($form, $form_state) { function ajax_forms_test_simple_form_select_callback($form, $form_state) {
$commands = array(); $commands = array();
@ -81,7 +80,7 @@ function ajax_forms_test_simple_form_select_callback($form, $form_state) {
} }
/** /**
* Ajax callback triggered by checkbox. * Ajax form callback: Selects checkbox value.
*/ */
function ajax_forms_test_simple_form_checkbox_callback($form, $form_state) { function ajax_forms_test_simple_form_checkbox_callback($form, $form_state) {
$commands = array(); $commands = array();
@ -90,9 +89,8 @@ function ajax_forms_test_simple_form_checkbox_callback($form, $form_state) {
return array('#type' => 'ajax', '#commands' => $commands); return array('#type' => 'ajax', '#commands' => $commands);
} }
/** /**
* Form to display the Ajax Commands. * Form constructor for the Ajax Command display form.
*/ */
function ajax_forms_test_ajax_commands_form($form, &$form_state) { function ajax_forms_test_ajax_commands_form($form, &$form_state) {
$form = array(); $form = array();
@ -272,7 +270,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) {
} }
/** /**
* Ajax callback for 'after'. * Ajax form callback: Selects 'after'.
*/ */
function ajax_forms_test_advanced_commands_after_callback($form, $form_state) { function ajax_forms_test_advanced_commands_after_callback($form, $form_state) {
$selector = '#after_div'; $selector = '#after_div';
@ -283,7 +281,7 @@ function ajax_forms_test_advanced_commands_after_callback($form, $form_state) {
} }
/** /**
* Ajax callback for 'alert'. * Ajax form callback: Selects 'alert'.
*/ */
function ajax_forms_test_advanced_commands_alert_callback($form, $form_state) { function ajax_forms_test_advanced_commands_alert_callback($form, $form_state) {
$commands = array(); $commands = array();
@ -292,7 +290,7 @@ function ajax_forms_test_advanced_commands_alert_callback($form, $form_state) {
} }
/** /**
* Ajax callback for 'append'. * Ajax form callback: Selects 'append'.
*/ */
function ajax_forms_test_advanced_commands_append_callback($form, $form_state) { function ajax_forms_test_advanced_commands_append_callback($form, $form_state) {
$selector = '#append_div'; $selector = '#append_div';
@ -302,7 +300,7 @@ function ajax_forms_test_advanced_commands_append_callback($form, $form_state) {
} }
/** /**
* Ajax callback for 'before'. * Ajax form callback: Selects 'before'.
*/ */
function ajax_forms_test_advanced_commands_before_callback($form, $form_state) { function ajax_forms_test_advanced_commands_before_callback($form, $form_state) {
$selector = '#before_div'; $selector = '#before_div';
@ -313,14 +311,15 @@ function ajax_forms_test_advanced_commands_before_callback($form, $form_state) {
} }
/** /**
* Ajax callback for 'changed'. * Ajax form callback: Selects 'changed'.
*/ */
function ajax_forms_test_advanced_commands_changed_callback($form, $form_state) { function ajax_forms_test_advanced_commands_changed_callback($form, $form_state) {
$commands[] = ajax_command_changed('#changed_div'); $commands[] = ajax_command_changed('#changed_div');
return array('#type' => 'ajax', '#commands' => $commands); return array('#type' => 'ajax', '#commands' => $commands);
} }
/** /**
* Ajax callback for 'changed' with asterisk marking inner div. * Ajax form callback: Selects 'changed' with asterisk marking inner div.
*/ */
function ajax_forms_test_advanced_commands_changed_asterisk_callback($form, $form_state) { function ajax_forms_test_advanced_commands_changed_asterisk_callback($form, $form_state) {
$commands = array(); $commands = array();
@ -329,7 +328,7 @@ function ajax_forms_test_advanced_commands_changed_asterisk_callback($form, $for
} }
/** /**
* Ajax callback for 'css'. * Ajax form callback: Selects 'css'.
*/ */
function ajax_forms_test_advanced_commands_css_callback($form, $form_state) { function ajax_forms_test_advanced_commands_css_callback($form, $form_state) {
$selector = '#css_div'; $selector = '#css_div';
@ -341,7 +340,7 @@ function ajax_forms_test_advanced_commands_css_callback($form, $form_state) {
} }
/** /**
* Ajax callback for 'data'. * Ajax form callback: Selects 'data'.
*/ */
function ajax_forms_test_advanced_commands_data_callback($form, $form_state) { function ajax_forms_test_advanced_commands_data_callback($form, $form_state) {
$selector = '#data_div'; $selector = '#data_div';
@ -352,7 +351,7 @@ function ajax_forms_test_advanced_commands_data_callback($form, $form_state) {
} }
/** /**
* Ajax callback for 'invoke'. * Ajax form callback: Selects 'invoke'.
*/ */
function ajax_forms_test_advanced_commands_invoke_callback($form, $form_state) { function ajax_forms_test_advanced_commands_invoke_callback($form, $form_state) {
$commands = array(); $commands = array();
@ -361,7 +360,7 @@ function ajax_forms_test_advanced_commands_invoke_callback($form, $form_state) {
} }
/** /**
* Ajax callback for 'html'. * Ajax form callback: Selects 'html'.
*/ */
function ajax_forms_test_advanced_commands_html_callback($form, $form_state) { function ajax_forms_test_advanced_commands_html_callback($form, $form_state) {
$commands = array(); $commands = array();
@ -370,7 +369,7 @@ function ajax_forms_test_advanced_commands_html_callback($form, $form_state) {
} }
/** /**
* Ajax callback for 'insert'. * Ajax form callback: Selects 'insert'.
*/ */
function ajax_forms_test_advanced_commands_insert_callback($form, $form_state) { function ajax_forms_test_advanced_commands_insert_callback($form, $form_state) {
$commands = array(); $commands = array();
@ -379,7 +378,7 @@ function ajax_forms_test_advanced_commands_insert_callback($form, $form_state) {
} }
/** /**
* Ajax callback for 'prepend'. * Ajax form callback: Selects 'prepend'.
*/ */
function ajax_forms_test_advanced_commands_prepend_callback($form, $form_state) { function ajax_forms_test_advanced_commands_prepend_callback($form, $form_state) {
$commands = array(); $commands = array();
@ -388,7 +387,7 @@ function ajax_forms_test_advanced_commands_prepend_callback($form, $form_state)
} }
/** /**
* Ajax callback for 'remove'. * Ajax form callback: Selects 'remove'.
*/ */
function ajax_forms_test_advanced_commands_remove_callback($form, $form_state) { function ajax_forms_test_advanced_commands_remove_callback($form, $form_state) {
$commands = array(); $commands = array();
@ -397,7 +396,7 @@ function ajax_forms_test_advanced_commands_remove_callback($form, $form_state) {
} }
/** /**
* Ajax callback for 'restripe'. * Ajax form callback: Selects 'restripe'.
*/ */
function ajax_forms_test_advanced_commands_restripe_callback($form, $form_state) { function ajax_forms_test_advanced_commands_restripe_callback($form, $form_state) {
$commands = array(); $commands = array();
@ -406,7 +405,7 @@ function ajax_forms_test_advanced_commands_restripe_callback($form, $form_state)
} }
/** /**
* Ajax callback for 'settings'. * Ajax form callback: Selects 'settings'.
*/ */
function ajax_forms_test_advanced_commands_settings_callback($form, $form_state) { function ajax_forms_test_advanced_commands_settings_callback($form, $form_state) {
$commands = array(); $commands = array();
@ -425,6 +424,8 @@ function ajax_forms_test_advanced_commands_add_css_callback($form, $form_state)
} }
/** /**
* Form constructor for AJAX validation form.
*
* This form and its related submit and callback functions demonstrate * 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.
* *
@ -433,6 +434,8 @@ function ajax_forms_test_advanced_commands_add_css_callback($form, $form_state)
* *
* 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". * be able to trigger without causing validation of the "required_field".
*
* @see ajax_forms_test_validation_form_submit()
*/ */
function ajax_forms_test_validation_form($form, &$form_state) { function ajax_forms_test_validation_form($form, &$form_state) {
@ -462,15 +465,18 @@ function ajax_forms_test_validation_form($form, &$form_state) {
return $form; return $form;
} }
/** /**
* Submit handler for the validation form. * Form submission handler for ajax_forms_test_validation_form().
*
* @see ajax_forms_test_validation_form()
*/ */
function ajax_forms_test_validation_form_submit($form, $form_state) { function ajax_forms_test_validation_form_submit($form, $form_state) {
drupal_set_message(t("Validation form submitted")); drupal_set_message(t("Validation form submitted"));
} }
/** /**
* Ajax callback for the 'drivertext' element of the validation form. * Ajax form callback: Selects the 'drivertext' element of the validation form.
*/ */
function ajax_forms_test_validation_form_callback($form, $form_state) { function ajax_forms_test_validation_form_callback($form, $form_state) {
drupal_set_message("ajax_forms_test_validation_form_callback invoked"); drupal_set_message("ajax_forms_test_validation_form_callback invoked");
@ -509,7 +515,7 @@ function ajax_forms_test_lazy_load_form_submit($form, &$form_state) {
} }
/** /**
* AJAX callback for the ajax_forms_test_lazy_load_form() form. * AJAX form callback: Selects for the ajax_forms_test_lazy_load_form() form.
* *
* This function returns nothing, because all we're interested in testing is * This function returns nothing, because all we're interested in testing is
* ajax_render() adding commands for JavaScript and CSS added during the page * ajax_render() adding commands for JavaScript and CSS added during the page

View File

@ -50,7 +50,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() { function ajax_test_error() {
$message = ''; $message = '';
@ -61,7 +61,7 @@ function ajax_test_error() {
} }
/** /**
* Menu callback; Renders a #type link with #ajax. * Menu callback: Renders a #type link with #ajax.
*/ */
function ajax_test_link() { function ajax_test_link() {
$build['link'] = array( $build['link'] = array(
@ -74,4 +74,3 @@ function ajax_test_link() {
); );
return $build; return $build;
} }

View File

@ -1,13 +1,12 @@
<?php <?php
/** /**
* @file * @file
* Batch callbacks for the Batch API tests. * Batch callbacks for the Batch API tests.
*/ */
/** /**
* Simple batch operation. * Performs a simple batch operation.
*/ */
function _batch_test_callback_1($id, $sleep, &$context) { function _batch_test_callback_1($id, $sleep, &$context) {
// No-op, but ensure the batch take a couple iterations. // No-op, but ensure the batch take a couple iterations.
@ -20,7 +19,7 @@ function _batch_test_callback_1($id, $sleep, &$context) {
} }
/** /**
* Multistep batch operation. * Performs a multistep batch operation.
*/ */
function _batch_test_callback_2($start, $total, $sleep, &$context) { function _batch_test_callback_2($start, $total, $sleep, &$context) {
// Initialize context with progress information. // Initialize context with progress information.
@ -53,7 +52,7 @@ function _batch_test_callback_2($start, $total, $sleep, &$context) {
} }
/** /**
* Simple batch operation. * Performs a simple batch operation.
*/ */
function _batch_test_callback_5($id, $sleep, &$context) { function _batch_test_callback_5($id, $sleep, &$context) {
// No-op, but ensure the batch take a couple iterations. // No-op, but ensure the batch take a couple iterations.
@ -68,7 +67,7 @@ function _batch_test_callback_5($id, $sleep, &$context) {
} }
/** /**
* Batch operation setting up its own batch. * Performs a batch operation setting up its own batch.
*/ */
function _batch_test_nested_batch_callback() { function _batch_test_nested_batch_callback() {
batch_test_stack('setting up batch 2'); batch_test_stack('setting up batch 2');
@ -76,7 +75,7 @@ function _batch_test_nested_batch_callback() {
} }
/** /**
* Common 'finished' callbacks for batches 1 to 4. * Provides a common 'finished' callback for batches 1 to 4.
*/ */
function _batch_test_finished_helper($batch_id, $success, $results, $operations) { function _batch_test_finished_helper($batch_id, $success, $results, $operations) {
$messages = array("results for batch $batch_id"); $messages = array("results for batch $batch_id");
@ -99,42 +98,42 @@ function _batch_test_finished_helper($batch_id, $success, $results, $operations)
} }
/** /**
* 'finished' callback for batch 0. * Triggers 'finished' callback for batch 0.
*/ */
function _batch_test_finished_0($success, $results, $operations) { function _batch_test_finished_0($success, $results, $operations) {
_batch_test_finished_helper(0, $success, $results, $operations); _batch_test_finished_helper(0, $success, $results, $operations);
} }
/** /**
* 'finished' callback for batch 1. * Triggers 'finished' callback for batch 1.
*/ */
function _batch_test_finished_1($success, $results, $operations) { function _batch_test_finished_1($success, $results, $operations) {
_batch_test_finished_helper(1, $success, $results, $operations); _batch_test_finished_helper(1, $success, $results, $operations);
} }
/** /**
* 'finished' callback for batch 2. * Triggers 'finished' callback for batch 2.
*/ */
function _batch_test_finished_2($success, $results, $operations) { function _batch_test_finished_2($success, $results, $operations) {
_batch_test_finished_helper(2, $success, $results, $operations); _batch_test_finished_helper(2, $success, $results, $operations);
} }
/** /**
* 'finished' callback for batch 3. * Triggers 'finished' callback for batch 3.
*/ */
function _batch_test_finished_3($success, $results, $operations) { function _batch_test_finished_3($success, $results, $operations) {
_batch_test_finished_helper(3, $success, $results, $operations); _batch_test_finished_helper(3, $success, $results, $operations);
} }
/** /**
* 'finished' callback for batch 4. * Triggers 'finished' callback for batch 4.
*/ */
function _batch_test_finished_4($success, $results, $operations) { function _batch_test_finished_4($success, $results, $operations) {
_batch_test_finished_helper(4, $success, $results, $operations); _batch_test_finished_helper(4, $success, $results, $operations);
} }
/** /**
* 'finished' callback for batch 5. * Triggers 'finished' callback for batch 5.
*/ */
function _batch_test_finished_5($success, $results, $operations) { function _batch_test_finished_5($success, $results, $operations) {
_batch_test_finished_helper(5, $success, $results, $operations); _batch_test_finished_helper(5, $success, $results, $operations);

View File

@ -6,7 +6,7 @@
*/ */
/** /**
* Implement hook_menu(). * Implements hook_menu().
*/ */
function batch_test_menu() { function batch_test_menu() {
$items = array(); $items = array();
@ -93,7 +93,9 @@ function batch_test_menu() {
} }
/** /**
* Simple form. * Form constructor for a batch selection form.
*
* @see batch_test_simple_form_submit()
*/ */
function batch_test_simple_form() { function batch_test_simple_form() {
$form['batch'] = array( $form['batch'] = array(
@ -116,7 +118,9 @@ function batch_test_simple_form() {
} }
/** /**
* Submit handler for the simple form. * Form submission handler for batch_test_simple_form().
*
* @see batch_test_simple_form()
*/ */
function batch_test_simple_form_submit($form, &$form_state) { function batch_test_simple_form_submit($form, &$form_state) {
batch_test_stack(NULL, TRUE); batch_test_stack(NULL, TRUE);
@ -129,7 +133,9 @@ function batch_test_simple_form_submit($form, &$form_state) {
/** /**
* Multistep form. * Form constructor for a multistep form.
*
* @see batch_test_multistep_form_submit()
*/ */
function batch_test_multistep_form($form, &$form_state) { function batch_test_multistep_form($form, &$form_state) {
if (empty($form_state['storage']['step'])) { if (empty($form_state['storage']['step'])) {
@ -148,7 +154,9 @@ function batch_test_multistep_form($form, &$form_state) {
} }
/** /**
* Submit handler for the multistep form. * Form submission handler for batch_test_multistep_form().
*
* @see batch_test_multistep_form()
*/ */
function batch_test_multistep_form_submit($form, &$form_state) { function batch_test_multistep_form_submit($form, &$form_state) {
batch_test_stack(NULL, TRUE); batch_test_stack(NULL, TRUE);
@ -172,7 +180,12 @@ function batch_test_multistep_form_submit($form, &$form_state) {
} }
/** /**
* Form with chained submit callbacks. * Form constructor for a form with chained submit callbacks.
*
* @see batch_test_chained_form_submit_1()
* @see batch_test_chained_form_submit_3()
* @see batch_test_chained_form_submit_3()
* @see batch_test_chained_form_submit_4()
*/ */
function batch_test_chained_form() { function batch_test_chained_form() {
// This value is used to test that $form_state persists through batched // This value is used to test that $form_state persists through batched
@ -197,7 +210,9 @@ function batch_test_chained_form() {
} }
/** /**
* Submit handler #1 for the chained form. * Form submission handler #1 for batch_test_chained_form().
*
* @see batch_test_chained_form()
*/ */
function batch_test_chained_form_submit_1($form, &$form_state) { function batch_test_chained_form_submit_1($form, &$form_state) {
batch_test_stack(NULL, TRUE); batch_test_stack(NULL, TRUE);
@ -213,7 +228,9 @@ function batch_test_chained_form_submit_1($form, &$form_state) {
} }
/** /**
* Submit handler #2 for the chained form. * Form submission handler #2 for batch_test_chained_form().
*
* @see batch_test_chained_form()
*/ */
function batch_test_chained_form_submit_2($form, &$form_state) { function batch_test_chained_form_submit_2($form, &$form_state) {
batch_test_stack('submit handler 2'); batch_test_stack('submit handler 2');
@ -227,7 +244,9 @@ function batch_test_chained_form_submit_2($form, &$form_state) {
} }
/** /**
* Submit handler #3 for the chained form. * Form submission handler #3 for batch_test_chained_form().
*
* @see batch_test_chained_form()
*/ */
function batch_test_chained_form_submit_3($form, &$form_state) { function batch_test_chained_form_submit_3($form, &$form_state) {
batch_test_stack('submit handler 3'); batch_test_stack('submit handler 3');
@ -240,7 +259,9 @@ function batch_test_chained_form_submit_3($form, &$form_state) {
} }
/** /**
* Submit handler #4 for the chained form. * Form submission handler #4 for batch_test_chained_form().
*
* @see batch_test_chained_form()
*/ */
function batch_test_chained_form_submit_4($form, &$form_state) { function batch_test_chained_form_submit_4($form, &$form_state) {
batch_test_stack('submit handler 4'); batch_test_stack('submit handler 4');
@ -254,7 +275,7 @@ function batch_test_chained_form_submit_4($form, &$form_state) {
} }
/** /**
* Menu callback: programmatically submits the 'Chained' form. * Menu callback: Submits the 'Chained' form programmatically.
*/ */
function batch_test_programmatic($value = 1) { function batch_test_programmatic($value = 1) {
$form_state = array( $form_state = array(
@ -265,7 +286,7 @@ function batch_test_programmatic($value = 1) {
} }
/** /**
* Menu callback: programmatically submits a form within a batch. * Menu callback: Submits a form within a batch programmatically.
*/ */
function batch_test_nested_drupal_form_submit($value = 1) { function batch_test_nested_drupal_form_submit($value = 1) {
// Set the batch and process it. // Set the batch and process it.
@ -277,7 +298,7 @@ function batch_test_nested_drupal_form_submit($value = 1) {
} }
/** /**
* Batch operation: submits form_test_mock_form using drupal_form_submit(). * Batch operation: Submits form_test_mock_form() using drupal_form_submit().
*/ */
function _batch_test_nested_drupal_form_submit_callback($value) { function _batch_test_nested_drupal_form_submit_callback($value) {
$state['values']['test_value'] = $value; $state['values']['test_value'] = $value;
@ -285,7 +306,9 @@ function _batch_test_nested_drupal_form_submit_callback($value) {
} }
/** /**
* A simple form with a textfield and submit button. * Form constructor for a simple form with a textfield and submit button.
*
* @see batch_test_mock_form_submit()
*/ */
function batch_test_mock_form($form, $form_state) { function batch_test_mock_form($form, $form_state) {
$form['test_value'] = array( $form['test_value'] = array(
@ -300,14 +323,16 @@ function batch_test_mock_form($form, $form_state) {
} }
/** /**
* Submit handler for the batch_test_mock form. * Form submission handler for batch_test_mock_form().
*
* @see batch_test_mock_form()
*/ */
function batch_test_mock_form_submit($form, &$form_state) { function batch_test_mock_form_submit($form, &$form_state) {
batch_test_stack('mock form submitted with value = ' . $form_state['values']['test_value']); batch_test_stack('mock form submitted with value = ' . $form_state['values']['test_value']);
} }
/** /**
* Menu callback: fire a batch process without a form submission. * Menu callback: Fires a batch process without a form submission.
*/ */
function batch_test_no_form() { function batch_test_no_form() {
batch_test_stack(NULL, TRUE); batch_test_stack(NULL, TRUE);
@ -317,7 +342,7 @@ function batch_test_no_form() {
} }
/** /**
* Menu callback: fire a batch process without a form submission. * Menu callback: Fires a batch process without a form submission.
*/ */
function batch_test_large_percentage() { function batch_test_large_percentage() {
batch_test_stack(NULL, TRUE); batch_test_stack(NULL, TRUE);
@ -327,14 +352,14 @@ function batch_test_large_percentage() {
} }
/** /**
* Menu callback: successful redirection. * Menu callback: Redirects successfuly.
*/ */
function batch_test_redirect_page() { function batch_test_redirect_page() {
return 'Redirection successful.'; return 'Redirection successful.';
} }
/** /**
* Batch 0: no operation. * Batch 0: Does nothing.
*/ */
function _batch_test_batch_0() { function _batch_test_batch_0() {
$batch = array( $batch = array(
@ -346,7 +371,7 @@ function _batch_test_batch_0() {
} }
/** /**
* Batch 1: repeats a simple operation. * Batch 1: Repeats a simple operation.
* *
* Operations: op 1 from 1 to 10. * Operations: op 1 from 1 to 10.
*/ */
@ -368,7 +393,7 @@ function _batch_test_batch_1() {
} }
/** /**
* Batch 2: single multistep operation. * Batch 2: Performs a single multistep operation.
* *
* Operations: op 2 from 1 to 10. * Operations: op 2 from 1 to 10.
*/ */
@ -389,7 +414,7 @@ function _batch_test_batch_2() {
} }
/** /**
* Batch 3: both single and multistep operations. * Batch 3: Performs both single and multistep operations.
* *
* Operations: * Operations:
* - op 1 from 1 to 5, * - op 1 from 1 to 5,
@ -420,7 +445,7 @@ function _batch_test_batch_3() {
} }
/** /**
* Batch 4: batch within a batch. * Batch 4: Performs a batch within a batch.
* *
* Operations: * Operations:
* - op 1 from 1 to 5, * - op 1 from 1 to 5,
@ -449,7 +474,7 @@ function _batch_test_batch_4() {
} }
/** /**
* Batch 5: repeats a simple operation. * Batch 5: Repeats a simple operation.
* *
* Operations: op 1 from 1 to 10. * Operations: op 1 from 1 to 10.
*/ */
@ -471,7 +496,7 @@ function _batch_test_batch_5() {
} }
/** /**
* Menu callback: run a batch for testing theme used on the progress page. * Menu callback: Runs a batch for testing theme used on the progress page.
*/ */
function batch_test_theme_batch() { function batch_test_theme_batch() {
batch_test_stack(NULL, TRUE); batch_test_stack(NULL, TRUE);
@ -485,7 +510,7 @@ function batch_test_theme_batch() {
} }
/** /**
* Batch callback function for testing the theme used on the progress page. * Tests the progress page theme by performing a batch callback.
*/ */
function _batch_test_theme_callback() { function _batch_test_theme_callback() {
// Because drupalGet() steps through the full progressive batch before // Because drupalGet() steps through the full progressive batch before
@ -498,7 +523,7 @@ function _batch_test_theme_callback() {
} }
/** /**
* Helper function: store or retrieve traced execution data. * Helper function: Stores or retrieves traced execution data.
*/ */
function batch_test_stack($data = NULL, $reset = FALSE) { function batch_test_stack($data = NULL, $reset = FALSE) {
if ($reset) { if ($reset) {

View File

@ -62,28 +62,32 @@ function common_test_menu() {
} }
/** /**
* Redirect using drupal_goto(). * Redirects using drupal_goto().
*/ */
function common_test_drupal_goto_redirect() { function common_test_drupal_goto_redirect() {
drupal_goto('common-test/drupal_goto'); drupal_goto('common-test/drupal_goto');
} }
/** /**
* Redirect using drupal_goto(). * Redirects using drupal_goto().
*/ */
function common_test_drupal_goto_redirect_advanced() { function common_test_drupal_goto_redirect_advanced() {
drupal_goto('common-test/drupal_goto', array('query' => array('foo' => '123')), 301); drupal_goto('common-test/drupal_goto', array('query' => array('foo' => '123')), 301);
} }
/** /**
* Landing page for drupal_goto(). * Page callback: Provides a landing page for drupal_goto().
*
* @see common_test_menu()
*/ */
function common_test_drupal_goto_land() { function common_test_drupal_goto_land() {
print "drupal_goto"; print "drupal_goto";
} }
/** /**
* Fail landing page for drupal_goto(). * Page callback: Provides a failure landing page for drupal_goto().
*
* @see common_test_menu()
*/ */
function common_test_drupal_goto_land_fail() { function common_test_drupal_goto_land_fail() {
print "drupal_goto_fail"; print "drupal_goto_fail";
@ -99,7 +103,7 @@ function common_test_drupal_goto_alter(&$path, &$options, &$http_response_code)
} }
/** /**
* Print destination query parameter. * Prints a destination query parameter.
*/ */
function common_test_destination() { function common_test_destination() {
$destination = drupal_get_destination(); $destination = drupal_get_destination();
@ -107,7 +111,7 @@ function common_test_destination() {
} }
/** /**
* Render an element with an invalid render array key. * Renders an element with an invalid render array key.
*/ */
function common_test_drupal_render_invalid_keys() { function common_test_drupal_render_invalid_keys() {
define('SIMPLETEST_COLLECT_ERRORS', FALSE); define('SIMPLETEST_COLLECT_ERRORS', FALSE);
@ -227,7 +231,7 @@ function common_test_theme() {
} }
/** /**
* Theme function for testing drupal_render() theming. * Provides a theme function for drupal_render().
*/ */
function theme_common_test_foo($variables) { function theme_common_test_foo($variables) {
return $variables['foo'] . $variables['bar']; return $variables['foo'] . $variables['bar'];

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* @file * @file
* Helper module for the testCronExceptions in addition to common_test module. * Helper module for the testCronExceptions in addition to common_test module.

View File

@ -77,7 +77,7 @@ function database_test_menu() {
} }
/** /**
* Run a db_query_temporary and output the table name and its number of rows. * Runs db_query_temporary() and outputs the table name and its number of rows.
* *
* We need to test that the table created is temporary, so we run it here, in a * We need to test that the table created is temporary, so we run it here, in a
* separate menu callback request; After this request is done, the temporary * separate menu callback request; After this request is done, the temporary
@ -92,7 +92,7 @@ function database_test_db_query_temporary() {
} }
/** /**
* Run a pager query and return the results. * Runs a pager query and returns the results.
* *
* This function does care about the page GET parameter, as set by the * This function does care about the page GET parameter, as set by the
* simpletest HTTP call. * simpletest HTTP call.
@ -117,7 +117,7 @@ function database_test_even_pager_query($limit) {
} }
/** /**
* Run a pager query and return the results. * Runs a pager query and returns the results.
* *
* This function does care about the page GET parameter, as set by the * This function does care about the page GET parameter, as set by the
* simpletest HTTP call. * simpletest HTTP call.
@ -142,7 +142,7 @@ function database_test_odd_pager_query($limit) {
} }
/** /**
* Run a tablesort query and return the results. * Runs a tablesort query and returns the results.
* *
* This function does care about the page GET parameter, as set by the * This function does care about the page GET parameter, as set by the
* simpletest HTTP call. * simpletest HTTP call.
@ -172,7 +172,7 @@ function database_test_tablesort() {
} }
/** /**
* Run a tablesort query with a second order_by after and return the results. * Runs a tablesort query with a second order_by after and returns the results.
* *
* This function does care about the page GET parameter, as set by the * This function does care about the page GET parameter, as set by the
* simpletest HTTP call. * simpletest HTTP call.
@ -203,7 +203,7 @@ function database_test_tablesort_first() {
} }
/** /**
* Output a form without setting a header sort. * Outputs a form without setting a header sort.
*/ */
function database_test_theme_tablesort($form, &$form_state) { function database_test_theme_tablesort($form, &$form_state) {
$header = array( $header = array(