Issue #1431658 by Albert Volkman, xjm, kid_icarus, ChinggizKhan, rgristroph, connork: Massive API docs cleanup for system tests
parent
1c2b1b855d
commit
75035ae4da
|
@ -30,8 +30,7 @@ class ConfigurationTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test the configuration of advanced actions through the administration
|
||||
* interface.
|
||||
* Tests configuration of advanced actions through administration interface.
|
||||
*/
|
||||
function testActionConfiguration() {
|
||||
// Create a user with permission to view the actions administration pages.
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\action\Tests;
|
|||
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 {
|
||||
|
||||
|
@ -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() {
|
||||
$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
|
||||
* times.
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ abstract class AjaxTestBase extends WebTestBase {
|
|||
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
|
||||
* commands. This array sometimes includes commands automatically provided by
|
||||
|
|
|
@ -20,7 +20,7 @@ class CommandsTest extends AjaxTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test the various Ajax Commands.
|
||||
* Tests the various Ajax Commands.
|
||||
*/
|
||||
function testAjaxCommands() {
|
||||
$form_path = 'ajax_forms_test_ajax_commands_form';
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Ajax;
|
||||
|
||||
/**
|
||||
* Miscellaneous Ajax tests using ajax_test module.
|
||||
* Tests using ajax_test module.
|
||||
*/
|
||||
class ElementValidationTest extends AjaxTestBase {
|
||||
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
|
||||
* is set to be a required field. In this test the required field is not
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
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 {
|
||||
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() {
|
||||
// Verify form values of a select element.
|
||||
|
|
|
@ -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
|
||||
* 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() {
|
||||
// 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() {
|
||||
$expected = array(
|
||||
|
|
|
@ -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() {
|
||||
// HTML IDs for elements within the field are potentially modified with
|
||||
|
|
|
@ -81,7 +81,7 @@ class PercentagesUnitTest extends UnitTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test the _batch_api_percentage() function.
|
||||
* Tests the _batch_api_percentage() function.
|
||||
*/
|
||||
function testBatchPercentages() {
|
||||
foreach ($this->testCases as $expected_result => $arguments) {
|
||||
|
|
|
@ -30,7 +30,7 @@ class ProcessingTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test batches triggered outside of form submission.
|
||||
* Tests batches triggered outside of form submission.
|
||||
*/
|
||||
function testBatchNoForm() {
|
||||
// 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() {
|
||||
// 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() {
|
||||
$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() {
|
||||
// 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().
|
||||
*/
|
||||
|
@ -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() {
|
||||
// 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.
|
||||
* See http://drupal.org/node/600836
|
||||
* Tests batches that return $context['finished'] > 1 do in fact complete.
|
||||
*
|
||||
* @see http://drupal.org/node/600836
|
||||
*/
|
||||
function testBatchLargePercentage() {
|
||||
// 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
|
||||
* 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) {
|
||||
$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) {
|
||||
$messages = array();
|
||||
|
|
|
@ -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() {
|
||||
// Reset the static cache so we can test the "db is not active" code of
|
||||
|
|
|
@ -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() {
|
||||
// Test with cache disabled. Boot and exit should always fire.
|
||||
|
|
|
@ -48,7 +48,7 @@ class IpAddressTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* test IP Address and hostname
|
||||
* Tests IP address and hostname.
|
||||
*/
|
||||
function testIPAddressHost() {
|
||||
// Test the normal IP address.
|
||||
|
|
|
@ -23,7 +23,7 @@ class MiscUnitTest extends UnitTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test miscellaneous functions in bootstrap.inc.
|
||||
* Tests miscellaneous functions in bootstrap.inc.
|
||||
*/
|
||||
function testMisc() {
|
||||
// Test drupal_array_merge_deep().
|
||||
|
|
|
@ -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() {
|
||||
$tests = array(
|
||||
|
|
|
@ -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() {
|
||||
$config = config('system.performance');
|
||||
|
@ -83,7 +83,7 @@ class PageCacheTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test cache headers.
|
||||
* Tests cache headers.
|
||||
*/
|
||||
function testPageCache() {
|
||||
$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,
|
||||
* .htaccess or similar, or if compression is done outside PHP, e.g. by the
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
function testDrupalStatic() {
|
||||
|
|
|
@ -23,9 +23,7 @@ class TimerUnitTest extends UnitTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test timer_read() to ensure it properly accumulates time when the timer
|
||||
* started and stopped multiple times.
|
||||
* @return
|
||||
* Tests timer_read() time accumulation accuracy across multiple restarts.
|
||||
*/
|
||||
function testTimer() {
|
||||
timer_start('test');
|
||||
|
|
|
@ -30,7 +30,7 @@ class VariableTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* testVariable
|
||||
* Tests variables then deletes them.
|
||||
*/
|
||||
function testVariable() {
|
||||
// Setting and retrieving values.
|
||||
|
|
|
@ -19,7 +19,7 @@ abstract class CacheTestBase extends WebTestBase {
|
|||
protected $default_value = 'CacheTest';
|
||||
|
||||
/**
|
||||
* Check whether or not a cache entry exists.
|
||||
* Checks whether or not a cache entry exists.
|
||||
*
|
||||
* @param $cid
|
||||
* 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
|
||||
* The bin to perform the wipe on.
|
||||
*/
|
||||
|
|
|
@ -28,7 +28,7 @@ class ClearTest extends CacheTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test drupal_flush_all_caches().
|
||||
* Tests drupal_flush_all_caches().
|
||||
*/
|
||||
function testFlushAllCaches() {
|
||||
// Create cache entries for each flushed cache bin.
|
||||
|
|
|
@ -128,8 +128,7 @@ abstract class GenericCacheBackendUnitTestBase extends UnitTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test Drupal\Core\Cache\CacheBackendInterface::get() and
|
||||
* Drupal\Core\Cache\CacheBackendInterface::set().
|
||||
* Tests the get and set methods of Drupal\Core\Cache\CacheBackendInterface.
|
||||
*/
|
||||
public function testSetGet() {
|
||||
$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() {
|
||||
$backend = $this->getCacheBackend();
|
||||
|
@ -174,7 +173,7 @@ abstract class GenericCacheBackendUnitTestBase extends UnitTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test data type perservation.
|
||||
* Tests data type preservation.
|
||||
*/
|
||||
public function testValueTypeIsKept() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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
|
||||
* 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() {
|
||||
$backend = $this->getCacheBackend();
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Common;
|
|||
use Drupal\simpletest\WebTestBase;
|
||||
|
||||
/**
|
||||
* Basic tests for drupal_add_feed().
|
||||
* Tests drupal_add_feed().
|
||||
*/
|
||||
class AddFeedTest extends WebTestBase {
|
||||
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() {
|
||||
$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 = '') {
|
||||
// Escape any regular expression characters in the URL ('?' is the worst).
|
||||
|
|
|
@ -30,6 +30,9 @@ class AlterTest extends WebTestBase {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the theme has been altered.
|
||||
*/
|
||||
function testDrupalAlter() {
|
||||
// This test depends on Bartik, so make sure that it is always the current
|
||||
// active theme.
|
||||
|
|
|
@ -29,7 +29,7 @@ class AutocompleteTagsUnitTest extends UnitTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Explode a series of tags.
|
||||
* Explodes a series of tags.
|
||||
*/
|
||||
function testDrupalExplodeTags() {
|
||||
$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() {
|
||||
$tags = array_values($this->validTags);
|
||||
|
|
|
@ -36,14 +36,14 @@ class CascadingStylesheetsTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check default stylesheets as empty.
|
||||
* Checks that default stylesheets are empty.
|
||||
*/
|
||||
function testDefault() {
|
||||
$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() {
|
||||
$this->drupalGet('');
|
||||
|
@ -172,7 +172,7 @@ class CascadingStylesheetsTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test CSS ordering.
|
||||
* Tests CSS ordering.
|
||||
*/
|
||||
function testRenderOrder() {
|
||||
// A module CSS file.
|
||||
|
@ -203,7 +203,7 @@ class CascadingStylesheetsTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test CSS override.
|
||||
* Tests CSS override.
|
||||
*/
|
||||
function testRenderOverride() {
|
||||
$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
|
||||
* query string parameters.
|
||||
* Tests that CSS query string remains intact when added to file.
|
||||
*/
|
||||
function testAddCssFileWithQueryString() {
|
||||
$this->drupalGet('common-test/query-string');
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Common;
|
|||
use Drupal\simpletest\UnitTestBase;
|
||||
|
||||
/**
|
||||
* CSS Unit Tests.
|
||||
* Tests CSS functions.
|
||||
*/
|
||||
class CascadingStylesheetsUnitTest extends UnitTestBase {
|
||||
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:
|
||||
* - Retain white-space in selectors. (http://drupal.org/node/472820)
|
||||
* - Proper URLs in imported files. (http://drupal.org/node/265719)
|
||||
|
|
|
@ -48,7 +48,7 @@ class FormatDateTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test admin-defined formats in format_date().
|
||||
* Tests admin-defined formats in format_date().
|
||||
*/
|
||||
function testAdminDefinedFormatDate() {
|
||||
// Create an admin user.
|
||||
|
|
|
@ -30,7 +30,7 @@ class GotoTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test drupal_goto().
|
||||
* Tests drupal_goto().
|
||||
*/
|
||||
function testDrupalGoto() {
|
||||
$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() {
|
||||
$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() {
|
||||
$query = $this->randomName(10);
|
||||
|
|
|
@ -30,6 +30,9 @@ class HttpRequestTest extends WebTestBase {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks HTTP requests.
|
||||
*/
|
||||
function testDrupalHTTPRequest() {
|
||||
global $is_https;
|
||||
|
||||
|
@ -73,6 +76,9 @@ class HttpRequestTest extends WebTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests HTTP basic authorization.
|
||||
*/
|
||||
function testDrupalHTTPRequestBasicAuth() {
|
||||
$username = $this->randomName();
|
||||
$password = $this->randomName();
|
||||
|
@ -86,6 +92,9 @@ class HttpRequestTest extends WebTestBase {
|
|||
$this->assertRaw($password, '$_SERVER["PHP_AUTH_PW"] is passed correctly.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests HTTP redirect requests.
|
||||
*/
|
||||
function testDrupalHTTPRequestRedirect() {
|
||||
$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.');
|
||||
|
|
|
@ -22,7 +22,7 @@ class JavaScriptTest extends WebTestBase {
|
|||
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;
|
||||
|
||||
|
@ -57,14 +57,14 @@ class JavaScriptTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test default JavaScript is empty.
|
||||
* Tests that default JavaScript is empty.
|
||||
*/
|
||||
function testDefault() {
|
||||
$this->assertEqual(array(), drupal_add_js(), 'Default JavaScript is empty.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test adding a JavaScript file.
|
||||
* Tests adding a JavaScript file.
|
||||
*/
|
||||
function testAddFile() {
|
||||
$javascript = drupal_add_js('core/misc/collapse.js');
|
||||
|
@ -72,7 +72,7 @@ class JavaScriptTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test adding settings.
|
||||
* Tests adding settings.
|
||||
*/
|
||||
function testAddSetting() {
|
||||
// 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() {
|
||||
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() {
|
||||
drupal_add_library('system', 'drupal');
|
||||
|
@ -189,7 +189,7 @@ class JavaScriptTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test adding inline scripts.
|
||||
* Tests adding inline scripts.
|
||||
*/
|
||||
function testAddInline() {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
$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()
|
||||
*/
|
||||
|
@ -270,7 +270,7 @@ class JavaScriptTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test JavaScript versioning.
|
||||
* Tests JavaScript versioning.
|
||||
*/
|
||||
function testVersionQueryString() {
|
||||
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() {
|
||||
$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() {
|
||||
// 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() {
|
||||
// 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()
|
||||
*/
|
||||
|
@ -523,8 +523,7 @@ class JavaScriptTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests that the query string remains intact when adding JavaScript files
|
||||
* that have query string parameters.
|
||||
* Tests JavaScript files that have querystrings attached get added right.
|
||||
*/
|
||||
function testAddJsFileWithQueryString() {
|
||||
$this->drupalGet('common-test/query-string');
|
||||
|
|
|
@ -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() {
|
||||
$info_values = drupal_parse_info_file(drupal_get_path('module', 'system') . '/tests/common_test_info.txt');
|
||||
|
|
|
@ -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() {
|
||||
global $theme_key;
|
||||
|
|
|
@ -30,7 +30,7 @@ class RenderTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test sorting by weight.
|
||||
* Tests sorting by weight.
|
||||
*/
|
||||
function testDrupalRenderSorting() {
|
||||
$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() {
|
||||
// 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() {
|
||||
$element = array(
|
||||
|
@ -144,12 +144,12 @@ class RenderTest extends WebTestBase {
|
|||
'#foo' => $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');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test rendering form elements without passing through form_builder().
|
||||
* Tests rendering form elements without passing through form_builder().
|
||||
*/
|
||||
function testDrupalRenderFormElements() {
|
||||
// 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() {
|
||||
$error = array(
|
||||
|
@ -284,6 +284,9 @@ class RenderTest extends WebTestBase {
|
|||
$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()) {
|
||||
$original_element = $element;
|
||||
$this->drupalSetContent(drupal_render($element));
|
||||
|
|
|
@ -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() {
|
||||
$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) {
|
||||
$this->assertEqual($error['group'], $group, format_string("Group was %group", array('%group' => $group)));
|
||||
|
|
|
@ -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() {
|
||||
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() {
|
||||
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() {
|
||||
foreach ($this->exact_test_cases as $size) {
|
||||
|
|
|
@ -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() {
|
||||
// Define the module files we will search for, and the directory precedence
|
||||
|
|
|
@ -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() {
|
||||
$text = $this->randomName();
|
||||
|
@ -58,7 +58,7 @@ class UrlTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test drupal_get_query_parameters().
|
||||
* Tests drupal_get_query_parameters().
|
||||
*/
|
||||
function testDrupalGetQueryParameters() {
|
||||
$original = array(
|
||||
|
@ -94,7 +94,7 @@ class UrlTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test drupal_http_build_query().
|
||||
* Tests drupal_http_build_query().
|
||||
*/
|
||||
function testDrupalHttpBuildQuery() {
|
||||
$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() {
|
||||
// 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
|
||||
* assert all that works when clean URLs are on and off.
|
||||
* Tests url() functionality.
|
||||
*
|
||||
* 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() {
|
||||
global $base_url, $script_path;
|
||||
|
@ -184,7 +186,7 @@ class UrlTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test external URL handling.
|
||||
* Tests external URL handling.
|
||||
*/
|
||||
function testExternalUrls() {
|
||||
$test_url = 'http://drupal.org/';
|
||||
|
|
|
@ -22,7 +22,7 @@ class ValidUrlUnitTest extends UnitTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test valid absolute URLs.
|
||||
* Tests valid absolute URLs.
|
||||
*/
|
||||
function testValidAbsolute() {
|
||||
$url_schemes = array('http', 'https', 'ftp');
|
||||
|
@ -57,7 +57,7 @@ class ValidUrlUnitTest extends UnitTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test invalid absolute URLs.
|
||||
* Tests invalid absolute URLs.
|
||||
*/
|
||||
function testInvalidAbsolute() {
|
||||
$url_schemes = array('http', 'https', 'ftp');
|
||||
|
@ -77,7 +77,7 @@ class ValidUrlUnitTest extends UnitTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test valid relative URLs.
|
||||
* Tests valid relative URLs.
|
||||
*/
|
||||
function testValidRelative() {
|
||||
$valid_relative_urls = array(
|
||||
|
@ -98,7 +98,7 @@ class ValidUrlUnitTest extends UnitTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test invalid relative URLs.
|
||||
* Tests invalid relative URLs.
|
||||
*/
|
||||
function testInvalidRelative() {
|
||||
$invalid_relative_urls = array(
|
||||
|
|
|
@ -31,7 +31,7 @@ class WriteRecordTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test the drupal_write_record() API function.
|
||||
* Tests the drupal_write_record() API function.
|
||||
*/
|
||||
function testDrupalWriteRecord() {
|
||||
// Insert a record with no columns populated.
|
||||
|
|
|
@ -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() {
|
||||
// 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() {
|
||||
$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() {
|
||||
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() {
|
||||
// Ensure that check_url() strips out harmful protocols, and encodes for
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Database;
|
||||
|
||||
/**
|
||||
* Select alter tests.
|
||||
* Tests alter queries.
|
||||
*
|
||||
* @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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
// Create a sub-query with an alter tag.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
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
|
||||
* 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() {
|
||||
$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() {
|
||||
$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() {
|
||||
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() {
|
||||
db_insert('test')
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Database;
|
||||
|
||||
/**
|
||||
* Test case sensitivity handling.
|
||||
* Tests case sensitivity handling.
|
||||
*/
|
||||
class CaseSensitivityTest extends DatabaseTestBase {
|
||||
public static function getInfo() {
|
||||
|
@ -20,7 +20,7 @@ class CaseSensitivityTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test BINARY collation in MySQL.
|
||||
* Tests BINARY collation in MySQL.
|
||||
*/
|
||||
function testCaseSensitiveInsert() {
|
||||
$num_records_before = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
|
|||
use Drupal\Core\Database\Database;
|
||||
|
||||
/**
|
||||
* Test connection management.
|
||||
* Tests connection management.
|
||||
*/
|
||||
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() {
|
||||
// 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() {
|
||||
// Clone the master credentials to a slave connection.
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
|
|||
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
|
||||
* 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
|
||||
* 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() {
|
||||
$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
|
||||
* INSERT operations here, just populate.
|
||||
|
|
|
@ -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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$num_records_before = db_query("SELECT COUNT(*) FROM {test}")->fetchField();
|
||||
|
|
|
@ -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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$result = new StatementEmpty();
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
|
||||
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
|
||||
* rather than just a stdClass or array. This class is for testing that
|
||||
|
|
|
@ -11,7 +11,7 @@ use Drupal\Core\Database\StatementInterface;
|
|||
use PDO;
|
||||
|
||||
/**
|
||||
* Test fetch actions, part 1.
|
||||
* Tests fetch actions.
|
||||
*
|
||||
* 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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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
|
||||
*/
|
||||
|
@ -90,7 +90,9 @@ class FetchTest extends DatabaseTestBase {
|
|||
$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() {
|
||||
$records = array();
|
||||
$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() {
|
||||
$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() {
|
||||
$records = array();
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
|
|||
use Drupal\Core\Database\Query\NoFieldsException;
|
||||
|
||||
/**
|
||||
* Insert tests for "database default" values.
|
||||
* Tests insertion for database default values.
|
||||
*/
|
||||
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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$query = db_insert('test')
|
||||
|
|
|
@ -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() {
|
||||
$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() {
|
||||
$id = db_insert('test_two_blobs')
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Database;
|
||||
|
||||
/**
|
||||
* Test the insert builder.
|
||||
* Tests the insert builder.
|
||||
*/
|
||||
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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
// 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() {
|
||||
$query = db_select('test_people', 'tp');
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
|
|||
use Exception;
|
||||
|
||||
/**
|
||||
* Test invalid data handling.
|
||||
* Tests invalid data handling.
|
||||
*/
|
||||
class InvalidDataTest extends DatabaseTestBase {
|
||||
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() {
|
||||
// Try to insert multiple records where at least one has bad data.
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
|
|||
use Drupal\Core\Database\Database;
|
||||
|
||||
/**
|
||||
* Query logging tests.
|
||||
* Tests query logging.
|
||||
*/
|
||||
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() {
|
||||
$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() {
|
||||
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() {
|
||||
// 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
|
||||
* 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() {
|
||||
// Clone the master credentials to a fake connection.
|
||||
|
|
|
@ -11,7 +11,7 @@ use Drupal\Core\Database\Query\Merge;
|
|||
use Drupal\Core\Database\Query\InvalidMergeQueryException;
|
||||
|
||||
/**
|
||||
* Test the MERGE query builder.
|
||||
* Tests the MERGE query builder.
|
||||
*/
|
||||
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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
try {
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
|
|||
use Drupal\simpletest\WebTestBase;
|
||||
|
||||
/**
|
||||
* Check the sequences API.
|
||||
* Checks the sequences API.
|
||||
*/
|
||||
class NextIdTest extends WebTestBase {
|
||||
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() {
|
||||
$first = db_next_id();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Database;
|
||||
|
||||
/**
|
||||
* Drupal-specific SQL syntax tests.
|
||||
* Tests Drupal-specific SQL syntax tests.
|
||||
*/
|
||||
class QueryTest extends DatabaseTestBase {
|
||||
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() {
|
||||
$names = db_query('SELECT name FROM {test} WHERE age IN (:ages) ORDER BY age', array(':ages' => array(25, 26, 27)))->fetchAll();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Database;
|
||||
|
||||
/**
|
||||
* Range query tests.
|
||||
* Tests range queries.
|
||||
*/
|
||||
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() {
|
||||
// Test if return correct number of rows.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Database;
|
||||
|
||||
/**
|
||||
* Regression tests.
|
||||
* Tests for database regressions.
|
||||
*/
|
||||
class RegressionTest extends DatabaseTestBase {
|
||||
|
||||
|
@ -28,10 +28,7 @@ class RegressionTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Regression test for #310447.
|
||||
*
|
||||
* Tries to insert non-ascii UTF-8 data in a database column and checks
|
||||
* if its stored properly.
|
||||
* Ensures that non-ASCII UTF-8 data is stored in the database properly.
|
||||
*/
|
||||
function testRegression_310447() {
|
||||
// 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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$this->assertIdentical(TRUE, db_index_exists('node', 'node_created'), 'Returns true for existent index.');
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Database;
|
||||
|
||||
/**
|
||||
* Test more complex select statements.
|
||||
* Tests more complex select statements.
|
||||
*/
|
||||
class SelectComplexTest extends DatabaseTestBase {
|
||||
|
||||
|
@ -28,7 +28,7 @@ class SelectComplexTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test simple JOIN statements.
|
||||
* Tests simple JOIN statements.
|
||||
*/
|
||||
function testDefaultJoin() {
|
||||
$query = db_select('test_task', 't');
|
||||
|
@ -53,7 +53,7 @@ class SelectComplexTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test LEFT OUTER joins.
|
||||
* Tests LEFT OUTER joins.
|
||||
*/
|
||||
function testLeftOuterJoin() {
|
||||
$query = db_select('test', 'p');
|
||||
|
@ -78,7 +78,7 @@ class SelectComplexTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test GROUP BY clauses.
|
||||
* Tests GROUP BY clauses.
|
||||
*/
|
||||
function testGroupBy() {
|
||||
$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() {
|
||||
$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() {
|
||||
$query = db_select('test');
|
||||
|
@ -166,7 +168,7 @@ class SelectComplexTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test distinct queries.
|
||||
* Tests distinct queries.
|
||||
*/
|
||||
function testDistinct() {
|
||||
$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() {
|
||||
$query = db_select('test');
|
||||
|
@ -214,8 +216,7 @@ class SelectComplexTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test that countQuery properly removes 'all_fields' statements and
|
||||
* ordering clauses.
|
||||
* Tests that countQuery removes 'all_fields' statements and ordering clauses.
|
||||
*/
|
||||
function testCountQueryRemovals() {
|
||||
$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() {
|
||||
// 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() {
|
||||
$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() {
|
||||
$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() {
|
||||
// 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() {
|
||||
$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() {
|
||||
$acct = $this->drupalCreateUser();
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\system\Tests\Database;
|
|||
use PDO;
|
||||
|
||||
/**
|
||||
* Test select with order by clauses.
|
||||
* Tests SELECT with ORDER BY clauses.
|
||||
*/
|
||||
class SelectOrderedTest extends DatabaseTestBase {
|
||||
|
||||
|
@ -23,7 +23,7 @@ class SelectOrderedTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test basic order by.
|
||||
* Tests basic ORDER BY.
|
||||
*/
|
||||
function testSimpleSelectOrdered() {
|
||||
$query = db_select('test');
|
||||
|
@ -44,7 +44,7 @@ class SelectOrderedTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test multiple order by.
|
||||
* Tests multiple ORDER BY.
|
||||
*/
|
||||
function testSimpleSelectMultiOrdered() {
|
||||
$query = db_select('test');
|
||||
|
@ -75,7 +75,7 @@ class SelectOrderedTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test order by descending.
|
||||
* Tests ORDER BY descending.
|
||||
*/
|
||||
function testSimpleSelectOrderedDesc() {
|
||||
$query = db_select('test');
|
||||
|
|
|
@ -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
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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() {
|
||||
$_GET['page'] = '3, 2, 1, 0';
|
||||
|
|
|
@ -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() {
|
||||
// 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() {
|
||||
// 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() {
|
||||
// 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() {
|
||||
// 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
|
||||
* 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
|
||||
* matching rows in the {test_people} table based on the shared name column.
|
||||
|
|
|
@ -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
|
||||
* 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() {
|
||||
$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() {
|
||||
$this->drupalGet('database_test/tablesort_default_sort');
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Database;
|
||||
|
||||
/**
|
||||
* Test the SELECT builder.
|
||||
* Tests the SELECT builder.
|
||||
*/
|
||||
class SelectTest extends DatabaseTestBase {
|
||||
|
||||
|
@ -21,7 +21,7 @@ class SelectTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test rudimentary SELECT statements.
|
||||
* Tests rudimentary SELECT statements.
|
||||
*/
|
||||
function testSimpleSelect() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$query = db_select('test');
|
||||
|
@ -100,7 +100,7 @@ class SelectTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test SELECT statements with expressions.
|
||||
* Tests SELECT statements with expressions.
|
||||
*/
|
||||
function testSimpleSelectExpression() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$this->ensureSampleDataNull();
|
||||
|
@ -234,8 +234,10 @@ class SelectTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test that we can UNION multiple Select queries together. This is
|
||||
* semantically equal to UNION DISTINCT, so we don't explicity test that.
|
||||
* Tests that we can UNION multiple Select queries together.
|
||||
*
|
||||
* This is semantically equal to UNION DISTINCT, so we don't explicity test
|
||||
* that.
|
||||
*/
|
||||
function testUnion() {
|
||||
$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() {
|
||||
$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
|
||||
* 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() {
|
||||
$query = db_select('test', 't');
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Database;
|
||||
|
||||
/**
|
||||
* Query serialization tests.
|
||||
* Tests query serialization.
|
||||
*/
|
||||
class SerializeQueryTest extends DatabaseTestBase {
|
||||
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() {
|
||||
$query = db_select('test');
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
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
|
||||
* 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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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.
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Database;
|
||||
|
||||
/**
|
||||
* Temporary query tests.
|
||||
* Tests temporary queries.
|
||||
*/
|
||||
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) {
|
||||
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() {
|
||||
$this->drupalGet('database_test/db_query_temporary');
|
||||
|
|
|
@ -13,7 +13,7 @@ use Drupal\Core\Database\TransactionNoActiveException;
|
|||
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
|
||||
* 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
|
||||
* starts and then encapsulates the "inner layer" transaction. This nesting
|
||||
* is used to evaluate whether the the database transaction API properly
|
||||
* supports nesting. By "properly supports," we mean the outer transaction
|
||||
* continues to exist regardless of what functions are called and whether
|
||||
* those functions start their own transactions.
|
||||
* Encapsulates a transaction's "inner layer" with an "outer layer".
|
||||
*
|
||||
* This "outer layer" transaction starts and then encapsulates the "inner
|
||||
* layer" transaction. This nesting is used to evaluate whether the the
|
||||
* database transaction API properly supports nesting. By "properly supports,"
|
||||
* 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
|
||||
* 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
|
||||
* is either used alone or nested inside of the "outer layer" transaction.
|
||||
* Creates an "inner layer" transaction.
|
||||
*
|
||||
* This "inner layer" transaction is either used alone or nested inside of the
|
||||
* "outer layer" transaction.
|
||||
*
|
||||
* @param $suffix
|
||||
* 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() {
|
||||
// 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.
|
||||
*/
|
||||
|
@ -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
|
||||
* 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() {
|
||||
// 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) {
|
||||
db_insert('test')
|
||||
|
@ -327,7 +332,7 @@ class TransactionTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Execute a DDL statement.
|
||||
* Executes a DDL statement.
|
||||
*/
|
||||
protected function executeDDLStatement() {
|
||||
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() {
|
||||
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
|
||||
* 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
|
||||
* 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() {
|
||||
// This test won't work right if transactions are not supported.
|
||||
|
|
|
@ -21,7 +21,7 @@ class UpdateComplexTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test updates with OR conditionals.
|
||||
* Tests updates with OR conditionals.
|
||||
*/
|
||||
function testOrConditionUpdate() {
|
||||
$update = db_update('test')
|
||||
|
@ -38,7 +38,7 @@ class UpdateComplexTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test WHERE IN clauses.
|
||||
* Tests WHERE IN clauses.
|
||||
*/
|
||||
function testInConditionUpdate() {
|
||||
$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() {
|
||||
// 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() {
|
||||
$num_updated = db_update('test')
|
||||
|
@ -82,7 +82,7 @@ class UpdateComplexTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test LIKE conditionals.
|
||||
* Tests LIKE conditionals.
|
||||
*/
|
||||
function testLikeConditionUpdate() {
|
||||
$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() {
|
||||
$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() {
|
||||
$before_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'))->fetchField();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Database;
|
||||
|
||||
/**
|
||||
* Test update queries involving LOB values.
|
||||
* Tests UPDATE queries involving LOB values.
|
||||
*/
|
||||
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() {
|
||||
$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() {
|
||||
$id = db_insert('test_two_blobs')
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Tests\Database;
|
||||
|
||||
/**
|
||||
* Update builder tests.
|
||||
* Updates builder tests.
|
||||
*/
|
||||
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() {
|
||||
$num_updated = db_update('test')
|
||||
|
@ -35,7 +35,7 @@ class UpdateTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Confirm updating to NULL.
|
||||
* Confirms updating to NULL.
|
||||
*/
|
||||
function testSimpleNullUpdate() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$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() {
|
||||
$update = db_update('test')
|
||||
|
@ -107,7 +107,7 @@ class UpdateTest extends DatabaseTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test updating with expressions.
|
||||
* Tests updating with expressions.
|
||||
*/
|
||||
function testExpressionUpdate() {
|
||||
// Set age = 1 for a single row for this test to work.
|
||||
|
|
|
@ -37,9 +37,8 @@ function ajax_forms_test_menu() {
|
|||
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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$commands = array();
|
||||
|
@ -90,9 +89,8 @@ function ajax_forms_test_simple_form_checkbox_callback($form, $form_state) {
|
|||
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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$commands[] = ajax_command_changed('#changed_div');
|
||||
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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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
|
||||
* 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
|
||||
* 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) {
|
||||
|
||||
|
@ -462,15 +465,18 @@ function ajax_forms_test_validation_form($form, &$form_state) {
|
|||
|
||||
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) {
|
||||
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) {
|
||||
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
|
||||
* ajax_render() adding commands for JavaScript and CSS added during the page
|
||||
|
|
|
@ -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() {
|
||||
$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() {
|
||||
$build['link'] = array(
|
||||
|
@ -74,4 +74,3 @@ function ajax_test_link() {
|
|||
);
|
||||
return $build;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Batch callbacks for the Batch API tests.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Simple batch operation.
|
||||
* Performs a simple batch operation.
|
||||
*/
|
||||
function _batch_test_callback_1($id, $sleep, &$context) {
|
||||
// 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) {
|
||||
// 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) {
|
||||
// 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() {
|
||||
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) {
|
||||
$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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_batch_test_finished_helper(5, $success, $results, $operations);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Implement hook_menu().
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
function batch_test_menu() {
|
||||
$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() {
|
||||
$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) {
|
||||
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) {
|
||||
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) {
|
||||
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() {
|
||||
// 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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
$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) {
|
||||
// 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) {
|
||||
$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) {
|
||||
$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) {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
return 'Redirection successful.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch 0: no operation.
|
||||
* Batch 0: Does nothing.
|
||||
*/
|
||||
function _batch_test_batch_0() {
|
||||
$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.
|
||||
*/
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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:
|
||||
* - 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:
|
||||
* - 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.
|
||||
*/
|
||||
|
@ -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() {
|
||||
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() {
|
||||
// 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) {
|
||||
if ($reset) {
|
||||
|
|
|
@ -62,28 +62,32 @@ function common_test_menu() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Redirect using drupal_goto().
|
||||
* Redirects using drupal_goto().
|
||||
*/
|
||||
function common_test_drupal_goto_redirect() {
|
||||
drupal_goto('common-test/drupal_goto');
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect using drupal_goto().
|
||||
* Redirects using drupal_goto().
|
||||
*/
|
||||
function common_test_drupal_goto_redirect_advanced() {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
$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() {
|
||||
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) {
|
||||
return $variables['foo'] . $variables['bar'];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Helper module for the testCronExceptions in addition to common_test module.
|
||||
|
|
|
@ -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
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* 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) {
|
||||
$header = array(
|
||||
|
|
Loading…
Reference in New Issue