update core to 7.36

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 19:33:23 +02:00
parent 6de56c702c
commit 802ec0c6f3
271 changed files with 4111 additions and 1227 deletions

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -293,7 +293,7 @@ class AJAXCommandsTestCase extends AJAXTestCase {
$this->assertCommand($commands, $expected, "'changed' AJAX command (with asterisk) issued with correct selector");
// Tests the 'css' command.
$commands = $this->drupalPostAJAX($form_path, $edit, array('op' => t("Set the the '#box' div to be blue.")));
$commands = $this->drupalPostAJAX($form_path, $edit, array('op' => t("Set the '#box' div to be blue.")));
$expected = array(
'command' => 'css',
'selector' => '#css_div',
@@ -368,6 +368,14 @@ class AJAXCommandsTestCase extends AJAXTestCase {
'settings' => array('ajax_forms_test' => array('foo' => 42)),
);
$this->assertCommand($commands, $expected, "'settings' AJAX command issued with correct data");
// Tests the 'add_css' command.
$commands = $this->drupalPostAJAX($form_path, $edit, array('op' => t("AJAX 'add_css' command")));
$expected = array(
'command' => 'add_css',
'data' => 'my/file.css',
);
$this->assertCommand($commands, $expected, "'add_css' AJAX command issued with correct data");
}
}

View File

@@ -5,8 +5,8 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -157,7 +157,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) {
// Shows the Ajax 'css' command.
$form['css_command_example'] = array(
'#value' => t("Set the the '#box' div to be blue."),
'#value' => t("Set the '#box' div to be blue."),
'#type' => 'submit',
'#ajax' => array(
'callback' => 'ajax_forms_test_advanced_commands_css_callback',
@@ -254,6 +254,15 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) {
),
);
// Shows the Ajax 'add_css' command.
$form['add_css_command_example'] = array(
'#type' => 'submit',
'#value' => t("AJAX 'add_css' command"),
'#ajax' => array(
'callback' => 'ajax_forms_test_advanced_commands_add_css_callback',
),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
@@ -406,6 +415,15 @@ function ajax_forms_test_advanced_commands_settings_callback($form, $form_state)
return array('#type' => 'ajax', '#commands' => $commands);
}
/**
* Ajax callback for 'add_css'.
*/
function ajax_forms_test_advanced_commands_add_css_callback($form, $form_state) {
$commands = array();
$commands[] = ajax_command_add_css('my/file.css');
return array('#type' => 'ajax', '#commands' => $commands);
}
/**
* This form and its related submit and callback functions demonstrate
* not validating another form element when a single Ajax element is triggered.

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -93,6 +93,11 @@ class BootstrapIPAddressTestCase extends DrupalWebTestCase {
$this->assertFalse(drupal_valid_http_host('security\\.drupal.org:80'), 'HTTP_HOST with \\ is invalid');
$this->assertFalse(drupal_valid_http_host('security<.drupal.org:80'), 'HTTP_HOST with &lt; is invalid');
$this->assertFalse(drupal_valid_http_host('security..drupal.org:80'), 'HTTP_HOST with .. is invalid');
// Verifies that host names are shorter than 1000 characters.
$this->assertFalse(drupal_valid_http_host(str_repeat('x', 1001)), 'HTTP_HOST with more than 1000 characters is invalid.');
$this->assertFalse(drupal_valid_http_host(str_repeat('.', 101)), 'HTTP_HOST with more than 100 subdomains is invalid.');
$this->assertFalse(drupal_valid_http_host(str_repeat(':', 101)), 'HTTP_HOST with more than 100 portseparators is invalid.');
// IPv6 loopback address
$this->assertTrue(drupal_valid_http_host('[::1]:80'), 'HTTP_HOST containing IPv6 loopback is valid');
}
@@ -139,7 +144,7 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
$this->assertResponse(200, 'Conditional request without If-None-Match returned 200 OK.');
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
$this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC1123, strtotime($last_modified) + 1), 'If-None-Match: ' . $etag));
$this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC7231, strtotime($last_modified) + 1), 'If-None-Match: ' . $etag));
$this->assertResponse(200, 'Conditional request with new a If-Modified-Since date newer than Last-Modified returned 200 OK.');
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
@@ -148,6 +153,8 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
$this->drupalGet('', array(), array('If-Modified-Since: ' . $last_modified, 'If-None-Match: ' . $etag));
$this->assertResponse(200, 'Conditional request returned 200 OK for authenticated user.');
$this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), 'Absense of Page was not cached.');
$this->assertFalse($this->drupalGetHeader('ETag'), 'ETag HTTP headers are not present for logged in users.');
$this->assertFalse($this->drupalGetHeader('Last-Modified'), 'Last-Modified HTTP headers are not present for logged in users.');
}
/**
@@ -281,6 +288,35 @@ class BootstrapVariableTestCase extends DrupalWebTestCase {
}
/**
* Tests the auto-loading behavior of the code registry.
*/
class BootstrapAutoloadTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Code registry',
'description' => 'Test that the code registry functions correctly.',
'group' => 'Bootstrap',
);
}
function setUp() {
parent::setUp('drupal_autoload_test');
}
/**
* Tests that autoloader name matching is not case sensitive.
*/
function testAutoloadCase() {
// Test interface autoloader.
$this->assertTrue(drupal_autoload_interface('drupalautoloadtestinterface'), 'drupal_autoload_interface() recognizes <em>DrupalAutoloadTestInterface</em> in lower case.');
// Test class autoloader.
$this->assertTrue(drupal_autoload_class('drupalautoloadtestclass'), 'drupal_autoload_class() recognizes <em>DrupalAutoloadTestClass</em> in lower case.');
}
}
/**
* Test hook_boot() and hook_exit().
*/
@@ -541,3 +577,85 @@ class BootstrapOverrideServerVariablesTestCase extends DrupalUnitTestCase {
}
}
}
/**
* Tests for $_GET['destination'] and $_REQUEST['destination'] validation.
*/
class BootstrapDestinationTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'URL destination validation',
'description' => 'Test that $_GET[\'destination\'] and $_REQUEST[\'destination\'] cannot contain external URLs.',
'group' => 'Bootstrap',
);
}
function setUp() {
parent::setUp('system_test');
}
/**
* Tests that $_GET/$_REQUEST['destination'] only contain internal URLs.
*
* @see _drupal_bootstrap_variables()
* @see system_test_get_destination()
* @see system_test_request_destination()
*/
public function testDestination() {
$test_cases = array(
array(
'input' => 'node',
'output' => 'node',
'message' => "Standard internal example node path is present in the 'destination' parameter.",
),
array(
'input' => '/example.com',
'output' => '/example.com',
'message' => 'Internal path with one leading slash is allowed.',
),
array(
'input' => '//example.com/test',
'output' => '',
'message' => 'External URL without scheme is not allowed.',
),
array(
'input' => 'example:test',
'output' => 'example:test',
'message' => 'Internal URL using a colon is allowed.',
),
array(
'input' => 'http://example.com',
'output' => '',
'message' => 'External URL is not allowed.',
),
array(
'input' => 'javascript:alert(0)',
'output' => 'javascript:alert(0)',
'message' => 'Javascript URL is allowed because it is treated as an internal URL.',
),
);
foreach ($test_cases as $test_case) {
// Test $_GET['destination'].
$this->drupalGet('system-test/get-destination', array('query' => array('destination' => $test_case['input'])));
$this->assertIdentical($test_case['output'], $this->drupalGetContent(), $test_case['message']);
// Test $_REQUEST['destination']. There's no form to submit to, so
// drupalPost() won't work here; this just tests a direct $_POST request
// instead.
$curl_parameters = array(
CURLOPT_URL => $this->getAbsoluteUrl('system-test/request-destination'),
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => 'destination=' . urlencode($test_case['input']),
CURLOPT_HTTPHEADER => array(),
);
$post_output = $this->curlExec($curl_parameters);
$this->assertIdentical($test_case['output'], $post_output, $test_case['message']);
}
// Make sure that 404 pages do not populate $_GET['destination'] with
// external URLs.
variable_set('site_404', 'system-test/get-destination');
$this->drupalGet('http://example.com', array('external' => FALSE));
$this->assertIdentical('', $this->drupalGetContent(), 'External URL is not allowed on 404 pages.');
}
}

View File

@@ -209,7 +209,16 @@ class CommonURLUnitTest extends DrupalWebTestCase {
// Test that drupal can recognize an absolute URL. Used to prevent attack vectors.
$this->assertTrue(url_is_external($url), 'Correctly identified an external URL.');
// External URL without an explicit protocol.
$url = '//drupal.org/foo/bar?foo=bar&bar=baz&baz#foo';
$this->assertTrue(url_is_external($url), 'Correctly identified an external URL without a protocol part.');
// Internal URL starting with a slash.
$url = '/drupal.org';
$this->assertFalse(url_is_external($url), 'Correctly identified an internal URL with a leading slash.');
// Test the parsing of absolute URLs.
$url = 'http://drupal.org/foo/bar?foo=bar&bar=baz&baz#foo';
$result = array(
'path' => 'http://drupal.org/foo/bar',
'query' => array('foo' => 'bar', 'bar' => 'baz', 'baz' => ''),
@@ -349,6 +358,17 @@ class CommonURLUnitTest extends DrupalWebTestCase {
$query = array($this->randomName(5) => $this->randomName(5));
$result = url($url, array('query' => $query));
$this->assertEqual($url . '&' . http_build_query($query, '', '&'), $result, 'External URL query string can be extended with a custom query string in $options.');
// Verify that an internal URL does not result in an external URL without
// protocol part.
$url = '/drupal.org';
$result = url($url);
$this->assertTrue(strpos($result, '//') === FALSE, 'Internal URL does not turn into an external URL.');
// Verify that an external URL without protocol part is recognized as such.
$url = '//drupal.org';
$result = url($url);
$this->assertEqual($url, $result, 'External URL without protocol is not altered.');
}
}
@@ -661,6 +681,10 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
drupal_add_css($css);
$styles = drupal_get_css();
$this->assertTrue(strpos($styles, $css) > 0, 'Rendered CSS includes the added stylesheet.');
// Verify that newlines are properly added inside style tags.
$query_string = variable_get('css_js_query_string', '0');
$css_processed = "<style type=\"text/css\" media=\"all\">\n@import url(\"" . check_plain(file_create_url($css)) . "?" . $query_string ."\");\n</style>";
$this->assertEqual(trim($styles), $css_processed, 'Rendered CSS includes newlines inside style tags for JavaScript use.');
}
/**
@@ -914,9 +938,10 @@ class CascadingStylesheetsUnitTest extends DrupalUnitTestCase {
* Tests basic CSS loading with and without optimization via drupal_load_stylesheet().
*
* Known tests:
* - Retain white-space in selectors. (http://drupal.org/node/472820)
* - Proper URLs in imported files. (http://drupal.org/node/265719)
* - Retain pseudo-selectors. (http://drupal.org/node/460448)
* - Retain white-space in selectors. (https://drupal.org/node/472820)
* - Proper URLs in imported files. (https://drupal.org/node/265719)
* - Retain pseudo-selectors. (https://drupal.org/node/460448)
* - Don't adjust data URIs. (https://drupal.org/node/2142441)
*/
function testLoadCssBasic() {
// Array of files to test living in 'simpletest/files/css_test_files/'.
@@ -1082,6 +1107,74 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
}
}
/**
* Tests parsing of the HTTP response status line.
*/
class DrupalHTTPResponseStatusLineTest extends DrupalUnitTestCase {
public static function getInfo() {
return array(
'name' => 'Drupal HTTP request response status parsing',
'description' => 'Perform unit tests on _drupal_parse_response_status().',
'group' => 'System',
);
}
/**
* Tests parsing HTTP response status line.
*/
public function testStatusLine() {
// Grab the big array of test data from statusLineData().
$data = $this->statusLineData();
foreach($data as $test_case) {
$test_data = array_shift($test_case);
$expected = array_shift($test_case);
$outcome = _drupal_parse_response_status($test_data);
foreach(array_keys($expected) as $key) {
$this->assertIdentical($outcome[$key], $expected[$key]);
}
}
}
/**
* Data provider for testStatusLine().
*
* @return array
* Test data.
*/
protected function statusLineData() {
return array(
array(
'HTTP/1.1 200 OK',
array(
'http_version' => 'HTTP/1.1',
'response_code' => '200',
'reason_phrase' => 'OK',
),
),
// Data set with no reason phrase.
array(
'HTTP/1.1 200',
array(
'http_version' => 'HTTP/1.1',
'response_code' => '200',
'reason_phrase' => '',
),
),
// Arbitrary strings.
array(
'version code multi word explanation',
array(
'http_version' => 'version',
'response_code' => 'code',
'reason_phrase' => 'multi word explanation',
),
),
);
}
}
/**
* Testing drupal_add_region_content and drupal_get_region_content.
*/
@@ -1347,6 +1440,127 @@ class JavaScriptTestCase extends DrupalWebTestCase {
$this->assertTrue(strpos($javascript, $inline) > 0, 'Rendered JavaScript footer returns the inline code.');
}
/**
* Test the 'javascript_always_use_jquery' variable.
*/
function testJavaScriptAlwaysUseJQuery() {
// The default front page of the site should use jQuery and other standard
// scripts and settings.
$this->drupalGet('');
$this->assertRaw('misc/jquery.js', 'Default behavior: The front page of the site includes jquery.js.');
$this->assertRaw('misc/drupal.js', 'Default behavior: The front page of the site includes drupal.js.');
$this->assertRaw('Drupal.settings', 'Default behavior: The front page of the site includes Drupal settings.');
$this->assertRaw('basePath', 'Default behavior: The front page of the site includes the basePath Drupal setting.');
// The default front page should not use jQuery and other standard scripts
// and settings when the 'javascript_always_use_jquery' variable is set to
// FALSE.
variable_set('javascript_always_use_jquery', FALSE);
$this->drupalGet('');
$this->assertNoRaw('misc/jquery.js', 'When "javascript_always_use_jquery" is FALSE: The front page of the site does not include jquery.js.');
$this->assertNoRaw('misc/drupal.js', 'When "javascript_always_use_jquery" is FALSE: The front page of the site does not include drupal.js.');
$this->assertNoRaw('Drupal.settings', 'When "javascript_always_use_jquery" is FALSE: The front page of the site does not include Drupal settings.');
$this->assertNoRaw('basePath', 'When "javascript_always_use_jquery" is FALSE: The front page of the site does not include the basePath Drupal setting.');
variable_del('javascript_always_use_jquery');
// When only settings have been added via drupal_add_js(), drupal_get_js()
// should still return jQuery and other standard scripts and settings.
$this->resetStaticVariables();
drupal_add_js(array('testJavaScriptSetting' => 'test'), 'setting');
$javascript = drupal_get_js();
$this->assertTrue(strpos($javascript, 'misc/jquery.js') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when only settings have been added includes jquery.js.');
$this->assertTrue(strpos($javascript, 'misc/drupal.js') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when only settings have been added includes drupal.js.');
$this->assertTrue(strpos($javascript, 'Drupal.settings') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when only settings have been added includes Drupal.settings.');
$this->assertTrue(strpos($javascript, 'basePath') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when only settings have been added includes the basePath Drupal setting.');
$this->assertTrue(strpos($javascript, 'testJavaScriptSetting') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when only settings have been added includes the added Drupal settings.');
// When only settings have been added via drupal_add_js() and the
// 'javascript_always_use_jquery' variable is set to FALSE, drupal_get_js()
// should not return jQuery and other standard scripts and settings, nor
// should it return the requested settings (since they cannot actually be
// addded to the page without jQuery).
$this->resetStaticVariables();
variable_set('javascript_always_use_jquery', FALSE);
drupal_add_js(array('testJavaScriptSetting' => 'test'), 'setting');
$javascript = drupal_get_js();
$this->assertTrue(strpos($javascript, 'misc/jquery.js') === FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when only settings have been added does not include jquery.js.');
$this->assertTrue(strpos($javascript, 'misc/drupal.js') === FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when only settings have been added does not include drupal.js.');
$this->assertTrue(strpos($javascript, 'Drupal.settings') === FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when only settings have been added does not include Drupal.settings.');
$this->assertTrue(strpos($javascript, 'basePath') === FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when only settings have been added does not include the basePath Drupal setting.');
$this->assertTrue(strpos($javascript, 'testJavaScriptSetting') === FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when only settings have been added does not include the added Drupal settings.');
variable_del('javascript_always_use_jquery');
// When a regular file has been added via drupal_add_js(), drupal_get_js()
// should return jQuery and other standard scripts and settings.
$this->resetStaticVariables();
drupal_add_js('misc/collapse.js');
$javascript = drupal_get_js();
$this->assertTrue(strpos($javascript, 'misc/jquery.js') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when a custom JavaScript file has been added includes jquery.js.');
$this->assertTrue(strpos($javascript, 'misc/drupal.js') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when a custom JavaScript file has been added includes drupal.js.');
$this->assertTrue(strpos($javascript, 'Drupal.settings') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when a custom JavaScript file has been added includes Drupal.settings.');
$this->assertTrue(strpos($javascript, 'basePath') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when a custom JavaScript file has been added includes the basePath Drupal setting.');
$this->assertTrue(strpos($javascript, 'misc/collapse.js') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when a custom JavaScript file has been added includes the custom file.');
// When a regular file has been added via drupal_add_js() and the
// 'javascript_always_use_jquery' variable is set to FALSE, drupal_get_js()
// should still return jQuery and other standard scripts and settings
// (since the file is assumed to require jQuery by default).
$this->resetStaticVariables();
variable_set('javascript_always_use_jquery', FALSE);
drupal_add_js('misc/collapse.js');
$javascript = drupal_get_js();
$this->assertTrue(strpos($javascript, 'misc/jquery.js') !== FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when a custom JavaScript file has been added includes jquery.js.');
$this->assertTrue(strpos($javascript, 'misc/drupal.js') !== FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when a custom JavaScript file has been added includes drupal.js.');
$this->assertTrue(strpos($javascript, 'Drupal.settings') !== FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when a custom JavaScript file has been added includes Drupal.settings.');
$this->assertTrue(strpos($javascript, 'basePath') !== FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when a custom JavaScript file has been added includes the basePath Drupal setting.');
$this->assertTrue(strpos($javascript, 'misc/collapse.js') !== FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when a custom JavaScript file has been added includes the custom file.');
variable_del('javascript_always_use_jquery');
// When a file that does not require jQuery has been added via
// drupal_add_js(), drupal_get_js() should still return jQuery and other
// standard scripts and settings by default.
$this->resetStaticVariables();
drupal_add_js('misc/collapse.js', array('requires_jquery' => FALSE));
$javascript = drupal_get_js();
$this->assertTrue(strpos($javascript, 'misc/jquery.js') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when a custom JavaScript file that does not require jQuery has been added includes jquery.js.');
$this->assertTrue(strpos($javascript, 'misc/drupal.js') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when a custom JavaScript file that does not require jQuery has been added includes drupal.js.');
$this->assertTrue(strpos($javascript, 'Drupal.settings') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when a custom JavaScript file that does not require jQuery has been added includes Drupal.settings.');
$this->assertTrue(strpos($javascript, 'basePath') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when a custom JavaScript file that does not require jQuery has been added includes the basePath Drupal setting.');
$this->assertTrue(strpos($javascript, 'misc/collapse.js') !== FALSE, 'Default behavior: The JavaScript returned by drupal_get_js() when a custom JavaScript file that does not require jQuery has been added includes the custom file.');
// When a file that does not require jQuery has been added via
// drupal_add_js() and the 'javascript_always_use_jquery' variable is set
// to FALSE, drupal_get_js() should not return jQuery and other standard
// scripts and setting, but it should still return the requested file.
$this->resetStaticVariables();
variable_set('javascript_always_use_jquery', FALSE);
drupal_add_js('misc/collapse.js', array('requires_jquery' => FALSE));
$javascript = drupal_get_js();
$this->assertTrue(strpos($javascript, 'misc/jquery.js') === FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when a custom JavaScript file that does not require jQuery has been added does not include jquery.js.');
$this->assertTrue(strpos($javascript, 'misc/drupal.js') === FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when a custom JavaScript file that does not require jQuery has been added does not include drupal.js.');
$this->assertTrue(strpos($javascript, 'Drupal.settings') === FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when a custom JavaScript file that does not require jQuery has been added does not include Drupal.settings.');
$this->assertTrue(strpos($javascript, 'basePath') === FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when a custom JavaScript file that does not require jQuery has been added does not include the basePath Drupal setting.');
$this->assertTrue(strpos($javascript, 'misc/collapse.js') !== FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when a custom JavaScript file that does not require jQuery has been added includes the custom file.');
variable_del('javascript_always_use_jquery');
// When 'javascript_always_use_jquery' is set to FALSE and a file that does
// not require jQuery is added, followed by one that does, drupal_get_js()
// should return jQuery and other standard scripts and settings, in
// addition to both of the requested files.
$this->resetStaticVariables();
variable_set('javascript_always_use_jquery', FALSE);
drupal_add_js('misc/collapse.js', array('requires_jquery' => FALSE));
drupal_add_js('misc/ajax.js');
$javascript = drupal_get_js();
$this->assertTrue(strpos($javascript, 'misc/jquery.js') !== FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when at least one custom JavaScript file that requires jQuery has been added includes jquery.js.');
$this->assertTrue(strpos($javascript, 'misc/drupal.js') !== FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when at least one custom JavaScript file that requires jQuery has been added includes drupal.js.');
$this->assertTrue(strpos($javascript, 'Drupal.settings') !== FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when at least one custom JavaScript file that requires jQuery has been added includes Drupal.settings.');
$this->assertTrue(strpos($javascript, 'basePath') !== FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when at least one custom JavaScript file that requires jQuery has been added includes the basePath Drupal setting.');
$this->assertTrue(strpos($javascript, 'misc/collapse.js') !== FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when at least one custom JavaScript file that requires jQuery has been added includes the first custom file.');
$this->assertTrue(strpos($javascript, 'misc/ajax.js') !== FALSE, 'When "javascript_always_use_jquery" is FALSE: The JavaScript returned by drupal_get_js() when at least one custom JavaScript file that requires jQuery has been added includes the second custom file.');
variable_del('javascript_always_use_jquery');
}
/**
* Test drupal_add_js() sets preproccess to false when cache is set to false.
*/
@@ -1575,6 +1789,15 @@ class JavaScriptTestCase extends DrupalWebTestCase {
$query_string = variable_get('css_js_query_string', '0');
$this->assertRaw(drupal_get_path('module', 'node') . '/node.js?' . $query_string, 'Query string was appended correctly to js.');
}
/**
* Resets static variables related to adding JavaScript to a page.
*/
function resetStaticVariables() {
drupal_static_reset('drupal_add_js');
drupal_static_reset('drupal_add_library');
drupal_static_reset('drupal_get_library');
}
}
/**

View File

@@ -7,8 +7,8 @@ stylesheets[all][] = common_test.css
stylesheets[print][] = common_test.print.css
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -238,7 +238,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
// Open the default target so we have an object to compare.
$db1 = Database::getConnection('default', 'default');
// Try to close the the default connection, then open a new one.
// Try to close the default connection, then open a new one.
Database::closeConnection('default', 'default');
$db2 = Database::getConnection('default', 'default');
@@ -1947,6 +1947,15 @@ class DatabaseSelectOrderedTestCase extends DatabaseTestCase {
$this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
}
/**
* Tests that the sort direction is sanitized properly.
*/
function testOrderByEscaping() {
$query = db_select('test')->orderBy('name', 'invalid direction');
$order_bys = $query->getOrderBy();
$this->assertEqual($order_bys['name'], 'ASC', 'Invalid order by direction is converted to ASC.');
}
}
/**
@@ -3384,6 +3393,34 @@ class DatabaseQueryTestCase extends DatabaseTestCase {
$this->assertEqual(count($names), 3, 'Correct number of names returned');
}
/**
* Test SQL injection via database query array arguments.
*/
public function testArrayArgumentsSQLInjection() {
// Attempt SQL injection and verify that it does not work.
$condition = array(
"1 ;INSERT INTO {test} (name) VALUES ('test12345678'); -- " => '',
'1' => '',
);
try {
db_query("SELECT * FROM {test} WHERE name = :name", array(':name' => $condition))->fetchObject();
$this->fail('SQL injection attempt via array arguments should result in a PDOException.');
}
catch (PDOException $e) {
$this->pass('SQL injection attempt via array arguments should result in a PDOException.');
}
// Test that the insert query that was used in the SQL injection attempt did
// not result in a row being inserted in the database.
$result = db_select('test')
->condition('name', 'test12345678')
->countQuery()
->execute()
->fetchField();
$this->assertFalse($result, 'SQL injection attempt did not result in a row being inserted in the database table.');
}
}
/**
@@ -3417,12 +3454,14 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
}
/**
* 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.
* 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
* 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,

View File

@@ -0,0 +1,14 @@
name = "Drupal code registry test"
description = "Support module for testing the code registry."
files[] = drupal_autoload_test_interface.inc
files[] = drupal_autoload_test_class.inc
package = Testing
version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1427943826"

View File

@@ -0,0 +1,6 @@
<?php
/**
* @file
* Test module to check code registry.
*/

View File

@@ -0,0 +1,11 @@
<?php
/**
* @file
* Test classes for code registry testing.
*/
/**
* This class is empty because we only care if Drupal can find it.
*/
class DrupalAutoloadTestClass implements DrupalAutoloadTestInterface {}

View File

@@ -0,0 +1,11 @@
<?php
/**
* @file
* Test interfaces for code registry testing.
*/
/**
* This interface is empty because we only care if Drupal can find it.
*/
interface DrupalAutoloadTestInterface {}

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -6,8 +6,8 @@ core = 7.x
dependencies[] = entity_cache_test_dependency
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -484,14 +484,6 @@ class FileValidatorTest extends DrupalWebTestCase {
$original_user = $user;
drupal_save_session(FALSE);
// Run these test as uid = 1.
$user = user_load(1);
$file = new stdClass();
$file->filesize = 999999;
$errors = file_validate_size($file, 1, 1);
$this->assertEqual(count($errors), 0, 'No size limits enforced on uid=1.', 'File');
// Run these tests as a regular user.
$user = $this->drupalCreateUser();
@@ -2564,6 +2556,7 @@ class FileNameMungingTest extends FileTestCase {
parent::setUp();
$this->bad_extension = 'php';
$this->name = $this->randomName() . '.' . $this->bad_extension . '.txt';
$this->name_with_uc_ext = $this->randomName() . '.' . strtoupper($this->bad_extension) . '.txt';
}
/**
@@ -2601,9 +2594,13 @@ class FileNameMungingTest extends FileTestCase {
* White listed extensions are ignored by file_munge_filename().
*/
function testMungeIgnoreWhitelisted() {
// Declare our extension as whitelisted.
$munged_name = file_munge_filename($this->name, $this->bad_extension);
$this->assertIdentical($munged_name, $this->name, format_string('The new filename (%munged) matches the original (%original) once the extension has been whitelisted.', array('%munged' => $munged_name, '%original' => $this->name)));
// Declare our extension as whitelisted. The declared extensions should
// be case insensitive so test using one with a different case.
$munged_name = file_munge_filename($this->name_with_uc_ext, $this->bad_extension);
$this->assertIdentical($munged_name, $this->name_with_uc_ext, format_string('The new filename (%munged) matches the original (%original) once the extension has been whitelisted.', array('%munged' => $munged_name, '%original' => $this->name_with_uc_ext)));
// The allowed extensions should also be normalized.
$munged_name = file_munge_filename($this->name, strtoupper($this->bad_extension));
$this->assertIdentical($munged_name, $this->name, format_string('The new filename (%munged) matches the original (%original) also when the whitelisted extension is in uppercase.', array('%munged' => $munged_name, '%original' => $this->name)));
}
/**

View File

@@ -6,8 +6,8 @@ core = 7.x
files[] = file_test.module
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -470,6 +470,64 @@ class FormsTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, array('checkboxes[one]' => TRUE, 'checkboxes[two]' => TRUE), t('Submit'));
$this->assertText('An illegal choice has been detected.', 'Input forgery was detected.');
}
/**
* Tests that submitted values are converted to scalar strings for textfields.
*/
public function testTextfieldStringValue() {
// Check multivalued submissions.
$multivalue = array('evil' => 'multivalue', 'not so' => 'good');
$this->checkFormValue('textfield', $multivalue, '');
$this->checkFormValue('password', $multivalue, '');
$this->checkFormValue('textarea', $multivalue, '');
$this->checkFormValue('machine_name', $multivalue, '');
$this->checkFormValue('password_confirm', $multivalue, array('pass1' => '', 'pass2' => ''));
// Check integer submissions.
$integer = 5;
$string = '5';
$this->checkFormValue('textfield', $integer, $string);
$this->checkFormValue('password', $integer, $string);
$this->checkFormValue('textarea', $integer, $string);
$this->checkFormValue('machine_name', $integer, $string);
$this->checkFormValue('password_confirm', array('pass1' => $integer, 'pass2' => $integer), array('pass1' => $string, 'pass2' => $string));
// Check that invalid array keys are ignored for password confirm elements.
$this->checkFormValue('password_confirm', array('pass1' => 'test', 'pass2' => 'test', 'extra' => 'invalid'), array('pass1' => 'test', 'pass2' => 'test'));
}
/**
* Checks that a given form input value is sanitized to the expected result.
*
* @param string $element_type
* The form element type. Example: textfield.
* @param mixed $input_value
* The submitted user input value for the form element.
* @param mixed $expected_value
* The sanitized result value in the form state after calling
* form_builder().
*/
protected function checkFormValue($element_type, $input_value, $expected_value) {
$form_id = $this->randomName();
$form = array();
$form_state = form_state_defaults();
$form['op'] = array('#type' => 'submit', '#value' => t('Submit'));
$form[$element_type] = array(
'#type' => $element_type,
'#title' => 'test',
);
$form_state['input'][$element_type] = $input_value;
$form_state['input']['form_id'] = $form_id;
$form_state['method'] = 'post';
$form_state['values'] = array();
drupal_prepare_form($form_id, $form, $form_state);
// This is the main function we want to test: it is responsible for
// populating user supplied $form_state['input'] to sanitized
// $form_state['values'].
form_builder($form_id, $form, $form_state);
$this->assertIdentical($form_state['values'][$element_type], $expected_value, format_string('Form submission for the "@element_type" element type has been correctly sanitized.', array('@element_type' => $element_type)));
}
}
/**

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -261,6 +261,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
*/
function testManipulations() {
// If GD isn't available don't bother testing this.
module_load_include('inc', 'system', 'image.gd');
if (!function_exists('image_gd_check_settings') || !image_gd_check_settings()) {
$this->pass(t('Image manipulations for the GD toolkit were skipped because the GD toolkit is not available.'));
return;
@@ -379,7 +380,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
array_fill(0, 3, 76) + array(3 => 0),
array_fill(0, 3, 149) + array(3 => 0),
array_fill(0, 3, 29) + array(3 => 0),
array_fill(0, 3, 0) + array(3 => 127)
array_fill(0, 3, 225) + array(3 => 127)
),
),
);
@@ -394,11 +395,14 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
continue 2;
}
// Transparent GIFs and the imagefilter function don't work together.
// There is a todo in image.gd.inc to correct this.
// All images should be converted to truecolor when loaded.
$image_truecolor = imageistruecolor($image->resource);
$this->assertTrue($image_truecolor, format_string('Image %file after load is a truecolor image.', array('%file' => $file)));
if ($image->info['extension'] == 'gif') {
if ($op == 'desaturate') {
$values['corners'][3] = $this->white;
// Transparent GIFs and the imagefilter function don't work together.
$values['corners'][3][3] = 0;
}
}
@@ -451,7 +455,8 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
$directory = file_default_scheme() . '://imagetests';
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
image_save($image, $directory . '/' . $op . '.' . $image->info['extension']);
$file_path = $directory . '/' . $op . '.' . $image->info['extension'];
image_save($image, $file_path);
$this->assertTrue($correct_dimensions_real, format_string('Image %file after %action action has proper dimensions.', array('%file' => $file, '%action' => $op)));
$this->assertTrue($correct_dimensions_object, format_string('Image %file object after %action action is reporting the proper height and width values.', array('%file' => $file, '%action' => $op)));
@@ -460,8 +465,37 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
$this->assertTrue($correct_colors, format_string('Image %file object after %action action has the correct color placement.', array('%file' => $file, '%action' => $op)));
}
}
}
// Check that saved image reloads without raising PHP errors.
$image_reloaded = image_load($file_path);
}
}
/**
* Tests loading an image whose transparent color index is out of range.
*/
function testTransparentColorOutOfRange() {
// This image was generated by taking an initial image with a palette size
// of 6 colors, and setting the transparent color index to 6 (one higher
// than the largest allowed index), as follows:
// @code
// $image = imagecreatefromgif('modules/simpletest/files/image-test.gif');
// imagecolortransparent($image, 6);
// imagegif($image, 'modules/simpletest/files/image-test-transparent-out-of-range.gif');
// @endcode
// This allows us to test that an image with an out-of-range color index
// can be loaded correctly.
$file = 'image-test-transparent-out-of-range.gif';
$image = image_load(drupal_get_path('module', 'simpletest') . '/files/' . $file);
if (!$image) {
$this->fail(format_string('Could not load image %file.', array('%file' => $file)));
}
else {
// All images should be converted to truecolor when loaded.
$image_truecolor = imageistruecolor($image->resource);
$this->assertTrue($image_truecolor, format_string('Image %file after load is a truecolor image.', array('%file' => $file)));
}
}
}

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -57,4 +57,25 @@ class PasswordHashingTest extends DrupalWebTestCase {
$this->assertFalse(user_needs_new_hash($account), 'Re-hashed password does not need a new hash.');
$this->assertTrue(user_check_password($password, $account), 'Password check succeeds with re-hashed password.');
}
/**
* Verifies that passwords longer than 512 bytes are not hashed.
*/
public function testLongPassword() {
$password = str_repeat('x', 512);
$result = user_hash_password($password);
$this->assertFalse(empty($result), '512 byte long password is allowed.');
$password = str_repeat('x', 513);
$result = user_hash_password($password);
$this->assertFalse($result, '513 byte long password is not allowed.');
// Check a string of 3-byte UTF-8 characters.
$password = str_repeat('€', 170);
$result = user_hash_password($password);
$this->assertFalse(empty($result), '510 byte long password is allowed.');
$password .= 'xx';
$this->assertFalse(empty($result), '512 byte long password is allowed.');
$password = str_repeat('€', 171);
$result = user_hash_password($password);
$this->assertFalse($result, '513 byte long password is not allowed.');
}
}

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ core = 7.x
hidden = TRUE
package = Testing
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -0,0 +1,12 @@
name = PSR-4 Test cases
description = Test classes to be discovered by simpletest.
core = 7.x
hidden = TRUE
package = Testing
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1427943826"

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1,18 @@
<?php
namespace Drupal\psr_4_test\Tests;
class ExampleTest extends \DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'PSR4 example test: PSR-4 in disabled modules.',
'description' => 'We want to assert that this test case is being discovered.',
'group' => 'SimpleTest',
);
}
function testArithmetics() {
$this->assert(1 + 1 == 2, '1 + 1 == 2');
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Drupal\psr_4_test\Tests\Nested;
class NestedExampleTest extends \DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'PSR4 example test: PSR-4 in nested subfolders.',
'description' => 'We want to assert that this PSR-4 test case is being discovered.',
'group' => 'SimpleTest',
);
}
function testArithmetics() {
$this->assert(1 + 1 == 2, '1 + 1 == 2');
}
}

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -7,8 +7,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -6,8 +6,8 @@ core = 7.x
hidden = TRUE
dependencies[] = _missing_dependency
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -6,8 +6,8 @@ core = 7.x
hidden = TRUE
dependencies[] = system_incompatible_core_version_test
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 5.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -7,8 +7,8 @@ hidden = TRUE
; system_incompatible_module_version_test declares version 1.0
dependencies[] = system_incompatible_module_version_test (>2.0)
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = 1.0
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -6,8 +6,8 @@ core = 7.x
files[] = system_test.module
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -78,6 +78,13 @@ function system_test_menu() {
'type' => MENU_CALLBACK,
);
$items['system-test/drupal-set-message'] = array(
'title' => 'Set messages with drupal_set_message()',
'page callback' => 'system_test_drupal_set_message',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['system-test/main-content-handling'] = array(
'title' => 'Test main content handling',
'page callback' => 'system_test_main_content_fallback',
@@ -106,6 +113,20 @@ function system_test_menu() {
'type' => MENU_CALLBACK,
);
$items['system-test/get-destination'] = array(
'title' => 'Test $_GET[\'destination\']',
'page callback' => 'system_test_get_destination',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['system-test/request-destination'] = array(
'title' => 'Test $_REQUEST[\'destination\']',
'page callback' => 'system_test_request_destination',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
return $items;
}
@@ -420,3 +441,41 @@ function system_test_authorize_init_page($page_title) {
system_authorized_init('system_test_authorize_run', drupal_get_path('module', 'system_test') . '/system_test.module', array(), $page_title);
drupal_goto($authorize_url);
}
/**
* Sets two messages and removes the first one before the messages are displayed.
*/
function system_test_drupal_set_message() {
// Set two messages.
drupal_set_message('First message (removed).');
drupal_set_message('Second message (not removed).');
// Remove the first.
unset($_SESSION['messages']['status'][0]);
return '';
}
/**
* Page callback to print out $_GET['destination'] for testing.
*/
function system_test_get_destination() {
if (isset($_GET['destination'])) {
print $_GET['destination'];
}
// No need to render the whole page, we are just interested in this bit of
// information.
exit;
}
/**
* Page callback to print out $_REQUEST['destination'] for testing.
*/
function system_test_request_destination() {
if (isset($_REQUEST['destination'])) {
print $_REQUEST['destination'];
}
// No need to render the whole page, we are just interested in this bit of
// information.
exit;
}

View File

@@ -6,8 +6,8 @@ core = 7.x
hidden = TRUE
dependencies[] = taxonomy
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -155,6 +155,15 @@ class ThemeTestCase extends DrupalWebTestCase {
$this->assertNotEqual(theme_get_setting('subtheme_override', 'test_basetheme'), theme_get_setting('subtheme_override', 'test_subtheme'), 'Base theme\'s default settings values can be overridden by subtheme.');
$this->assertIdentical(theme_get_setting('basetheme_only', 'test_subtheme'), 'base theme value', 'Base theme\'s default settings values are inherited by subtheme.');
}
/**
* Test the drupal_add_region_content() function.
*/
function testDrupalAddRegionContent() {
$this->drupalGet('theme-test/drupal-add-region-content');
$this->assertText('Hello');
$this->assertText('World');
}
}
/**
@@ -425,28 +434,100 @@ class ThemeFastTestCase extends DrupalWebTestCase {
}
/**
* Unit tests for theme_html_tag().
* Tests the markup of core render element types passed to drupal_render().
*/
class ThemeHtmlTag extends DrupalUnitTestCase {
class RenderElementTypesTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Theme HTML Tag',
'description' => 'Tests theme_html_tag() built-in theme functions.',
'name' => 'Render element types',
'description' => 'Tests the markup of core render element types passed to drupal_render().',
'group' => 'Theme',
);
}
/**
* Test function theme_html_tag()
* Asserts that an array of elements is rendered properly.
*
* @param array $elements
* An array of associative arrays describing render elements and their
* expected markup. Each item in $elements must contain the following:
* - 'name': This human readable description will be displayed on the test
* results page.
* - 'value': This is the render element to test.
* - 'expected': This is the expected markup for the element in 'value'.
*/
function testThemeHtmlTag() {
// Test auto-closure meta tag generation
$tag['element'] = array('#tag' => 'meta', '#attributes' => array('name' => 'description', 'content' => 'Drupal test'));
$this->assertEqual('<meta name="description" content="Drupal test" />'."\n", theme_html_tag($tag), 'Test auto-closure meta tag generation.');
function assertElements($elements) {
foreach($elements as $element) {
$this->assertIdentical(drupal_render($element['value']), $element['expected'], '"' . $element['name'] . '" input rendered correctly by drupal_render().');
}
}
// Test title tag generation
$tag['element'] = array('#tag' => 'title', '#value' => 'title test');
$this->assertEqual('<title>title test</title>'."\n", theme_html_tag($tag), 'Test title tag generation.');
/**
* Tests system #type 'container'.
*/
function testContainer() {
$elements = array(
// Basic container with no attributes.
array(
'name' => "#type 'container' with no HTML attributes",
'value' => array(
'#type' => 'container',
'child' => array(
'#markup' => 'foo',
),
),
'expected' => '<div>foo</div>',
),
// Container with a class.
array(
'name' => "#type 'container' with a class HTML attribute",
'value' => array(
'#type' => 'container',
'child' => array(
'#markup' => 'foo',
),
'#attributes' => array(
'class' => 'bar',
),
),
'expected' => '<div class="bar">foo</div>',
),
);
$this->assertElements($elements);
}
/**
* Tests system #type 'html_tag'.
*/
function testHtmlTag() {
$elements = array(
// Test auto-closure meta tag generation.
array(
'name' => "#type 'html_tag' auto-closure meta tag generation",
'value' => array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'description',
'content' => 'Drupal test',
),
),
'expected' => '<meta name="description" content="Drupal test" />' . "\n",
),
// Test title tag generation.
array(
'name' => "#type 'html_tag' title tag generation",
'value' => array(
'#type' => 'html_tag',
'#tag' => 'title',
'#value' => 'title test',
),
'expected' => '<title>title test</title>' . "\n",
),
);
$this->assertElements($elements);
}
}
@@ -500,3 +581,68 @@ class ThemeRegistryTestCase extends DrupalWebTestCase {
$this->assertTrue($registry['theme_test_template_test_2'], 'Offset was returned correctly from the theme registry');
}
}
/**
* Tests for theme debug markup.
*/
class ThemeDebugMarkupTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Theme debug markup',
'description' => 'Tests theme debug markup output.',
'group' => 'Theme',
);
}
function setUp() {
parent::setUp('theme_test', 'node');
theme_enable(array('test_theme'));
}
/**
* Tests debug markup added to template output.
*/
function testDebugOutput() {
variable_set('theme_default', 'test_theme');
// Enable the debug output.
variable_set('theme_debug', TRUE);
$registry = theme_get_registry();
$extension = '.tpl.php';
// Populate array of templates.
$templates = drupal_find_theme_templates($registry, $extension, drupal_get_path('theme', 'test_theme'));
$templates += drupal_find_theme_templates($registry, $extension, drupal_get_path('module', 'node'));
// Create a node and test different features of the debug markup.
$node = $this->drupalCreateNode();
$this->drupalGet('node/' . $node->nid);
$this->assertRaw('<!-- THEME DEBUG -->', 'Theme debug markup found in theme output when debug is enabled.');
$this->assertRaw("CALL: theme('node')", 'Theme call information found.');
$this->assertRaw('x node--1' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' * node' . $extension, 'Suggested template files found in order and node ID specific template shown as current template.');
$template_filename = $templates['node__1']['path'] . '/' . $templates['node__1']['template'] . $extension;
$this->assertRaw("BEGIN OUTPUT from '$template_filename'", 'Full path to current template file found.');
// Create another node and make sure the template suggestions shown in the
// debug markup are correct.
$node2 = $this->drupalCreateNode();
$this->drupalGet('node/' . $node2->nid);
$this->assertRaw('* node--2' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' x node' . $extension, 'Suggested template files found in order and base template shown as current template.');
// Create another node and make sure the template suggestions shown in the
// debug markup are correct.
$node3 = $this->drupalCreateNode();
$build = array('#theme' => 'node__foo__bar');
$build += node_view($node3);
$output = drupal_render($build);
$this->assertTrue(strpos($output, "CALL: theme('node__foo__bar')") !== FALSE, 'Theme call information found.');
$this->assertTrue(strpos($output, '* node--foo--bar' . $extension . PHP_EOL . ' * node--foo' . $extension . PHP_EOL . ' * node--3' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' x node' . $extension) !== FALSE, 'Suggested template files found in order and base template shown as current template.');
// Disable theme debug.
variable_set('theme_debug', FALSE);
$this->drupalGet('node/' . $node->nid);
$this->assertNoRaw('<!-- THEME DEBUG -->', 'Theme debug markup not found in theme output when debug is disabled.');
}
}

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -53,6 +53,11 @@ function theme_test_menu() {
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['theme-test/drupal-add-region-content'] = array(
'page callback' => '_theme_test_drupal_add_region_content',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
return $items;
}
@@ -126,6 +131,14 @@ function _theme_test_suggestion() {
return theme(array('theme_test__suggestion', 'theme_test'), array());
}
/**
* Page callback, calls drupal_add_region_content.
*/
function _theme_test_drupal_add_region_content() {
drupal_add_region_content('content', 'World');
return 'Hello';
}
/**
* Theme function for testing theme('theme_test_foo').
*/

View File

@@ -6,8 +6,8 @@ hidden = TRUE
settings[basetheme_only] = base theme value
settings[subtheme_override] = base theme value
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -6,8 +6,8 @@ hidden = TRUE
settings[subtheme_override] = subtheme value
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -0,0 +1,2 @@
<!-- Output for Theme Debug Markup test -->
Node Content Dummy

View File

@@ -17,8 +17,8 @@ stylesheets[all][] = system.base.css
settings[theme_test_setting] = default value
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -211,6 +211,11 @@ class XMLRPCMessagesTestCase extends DrupalWebTestCase {
* Make sure that XML-RPC can transfer large messages.
*/
function testSizedMessages() {
// These tests can produce up to 128 x 160 words in the XML-RPC message
// (see xmlrpc_test_message_sized_in_kb()) with 4 tags used to represent
// each. Set a large enough tag limit to allow this to be tested.
variable_set('xmlrpc_message_maximum_tag_count', 100000);
$xml_url = url(NULL, array('absolute' => TRUE)) . 'xmlrpc.php';
$sizes = array(8, 80, 160);
foreach ($sizes as $size) {

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"