core security update
This commit is contained in:
@@ -853,6 +853,13 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
*/
|
||||
protected $cookieFile = NULL;
|
||||
|
||||
/**
|
||||
* The cookies of the page currently loaded in the internal browser.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $cookies = array();
|
||||
|
||||
/**
|
||||
* Additional cURL options.
|
||||
*
|
||||
@@ -942,7 +949,6 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
protected function drupalCreateNode($settings = array()) {
|
||||
// Populate defaults array.
|
||||
$settings += array(
|
||||
'body' => array(LANGUAGE_NONE => array(array())),
|
||||
'title' => $this->randomName(8),
|
||||
'comment' => 2,
|
||||
'changed' => REQUEST_TIME,
|
||||
@@ -957,6 +963,12 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
'language' => LANGUAGE_NONE,
|
||||
);
|
||||
|
||||
// Add the body after the language is defined so that it may be set
|
||||
// properly.
|
||||
$settings += array(
|
||||
'body' => array($settings['language'] => array(array())),
|
||||
);
|
||||
|
||||
// Use the original node's created time for existing nodes.
|
||||
if (isset($settings['created']) && !isset($settings['date'])) {
|
||||
$settings['date'] = format_date($settings['created'], 'custom', 'Y-m-d H:i:s O');
|
||||
@@ -1015,9 +1027,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
'description' => '',
|
||||
'help' => '',
|
||||
'title_label' => 'Title',
|
||||
'body_label' => 'Body',
|
||||
'has_title' => 1,
|
||||
'has_body' => 1,
|
||||
);
|
||||
// Imposed values for a custom type.
|
||||
$forced = array(
|
||||
@@ -1067,7 +1077,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
$lines = array(16, 256, 1024, 2048, 20480);
|
||||
$count = 0;
|
||||
foreach ($lines as $line) {
|
||||
simpletest_generate_file('text-' . $count++, 64, $line);
|
||||
simpletest_generate_file('text-' . $count++, 64, $line, 'text');
|
||||
}
|
||||
|
||||
// Copy other test files from simpletest.
|
||||
@@ -1695,8 +1705,10 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
$GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
|
||||
}
|
||||
|
||||
// Close the CURL handler.
|
||||
// Close the CURL handler and reset the cookies array so test classes
|
||||
// containing multiple tests are not polluted.
|
||||
$this->curlClose();
|
||||
$this->cookies = array();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2221,6 +2233,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
|
||||
// Submit the POST request.
|
||||
$return = drupal_json_decode($this->drupalPost(NULL, $edit, array('path' => $ajax_path, 'triggering_element' => $triggering_element), $options, $headers, $form_html_id, $extra_post));
|
||||
$this->assertIdentical($this->drupalGetHeader('X-Drupal-Ajax-Token'), '1', 'Ajax response header found.');
|
||||
|
||||
// Change the page content by applying the returned commands.
|
||||
if (!empty($ajax_settings) && !empty($return)) {
|
||||
@@ -2257,8 +2270,13 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
if ($wrapperNode) {
|
||||
// ajax.js adds an enclosing DIV to work around a Safari bug.
|
||||
$newDom = new DOMDocument();
|
||||
// DOM can load HTML soup. But, HTML soup can throw warnings,
|
||||
// suppress them.
|
||||
$newDom->loadHTML('<div>' . $command['data'] . '</div>');
|
||||
$newNode = $dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE);
|
||||
// Suppress warnings thrown when duplicate HTML IDs are
|
||||
// encountered. This probably means we are replacing an element
|
||||
// with the same ID.
|
||||
$newNode = @$dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE);
|
||||
$method = isset($command['method']) ? $command['method'] : $ajax_settings['method'];
|
||||
// The "method" is a jQuery DOM manipulation function. Emulate
|
||||
// each one using PHP's DOMNode API.
|
||||
@@ -2580,6 +2598,11 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
*
|
||||
* @param $xpath
|
||||
* The xpath string to use in the search.
|
||||
* @param array $arguments
|
||||
* An array of arguments with keys in the form ':name' matching the
|
||||
* placeholders in the query. The values may be either strings or numeric
|
||||
* values.
|
||||
*
|
||||
* @return
|
||||
* The return value of the xpath search. For details on the xpath string
|
||||
* format and return values see the SimpleXML documentation,
|
||||
@@ -2751,7 +2774,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
$path = substr($path, $length);
|
||||
}
|
||||
// Ensure that we have an absolute path.
|
||||
if ($path[0] !== '/') {
|
||||
if (empty($path) || $path[0] !== '/') {
|
||||
$path = '/' . $path;
|
||||
}
|
||||
// Finally, prepend the $base_url.
|
||||
|
@@ -1,5 +1,7 @@
|
||||
|
||||
|
||||
@import url("http://example.com/style.css");
|
||||
@import url("//example.com/style.css");
|
||||
@import "import1.css";
|
||||
@import "import2.css";
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
ul,select{font:1em/160% Verdana,sans-serif;color:#494949;}.ui-icon{background-image:url(images/icon.png);}.data .double-quote{background-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");}.data .single-quote{background-image:url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDACAWGBwYFCAcGhwkIiAmMFA0MCwsMGJGSjpQdGZ6eHJmcG6AkLicgIiuim5woNqirr7EztDOfJri8uDI8LjKzsb/2wBDASIkJDAqMF40NF7GhHCExsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsb/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAb/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFAEBAAAAAAAAAAAAAAAAAAAAAP/EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AKAAH//Z');}.data .no-quote{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAEAQAAAAAo/mtHAAAAIElEQVQIHWMRnWHwcRNLN8NZ7QYWwT8PlBlYsgqVBRsAankIMw5MtnoAAAAASUVORK5CYII=);}
|
||||
@import url("http://example.com/style.css");@import url("//example.com/style.css");ul,select{font:1em/160% Verdana,sans-serif;color:#494949;}.ui-icon{background-image:url(images/icon.png);}.data .double-quote{background-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");}.data .single-quote{background-image:url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDACAWGBwYFCAcGhwkIiAmMFA0MCwsMGJGSjpQdGZ6eHJmcG6AkLicgIiuim5woNqirr7EztDOfJri8uDI8LjKzsb/2wBDASIkJDAqMF40NF7GhHCExsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsb/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAb/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFAEBAAAAAAAAAAAAAAAAAAAAAP/EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AKAAH//Z');}.data .no-quote{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAEAQAAAAAo/mtHAAAAIElEQVQIHWMRnWHwcRNLN8NZ7QYWwT8PlBlYsgqVBRsAankIMw5MtnoAAAAASUVORK5CYII=);}
|
||||
p,select{font:1em/160% Verdana,sans-serif;color:#494949;}
|
||||
body{margin:0;padding:0;background:#edf5fa;font:76%/170% Verdana,sans-serif;color:#494949;}.this .is .a .test{font:1em/100% Verdana,sans-serif;color:#494949;}.this
|
||||
.is
|
||||
|
@@ -1,5 +1,7 @@
|
||||
|
||||
|
||||
@import url("http://example.com/style.css");
|
||||
@import url("//example.com/style.css");
|
||||
|
||||
ul, select {
|
||||
font: 1em/160% Verdana, sans-serif;
|
||||
|
BIN
modules/simpletest/files/image-test-no-transparency.gif
Normal file
BIN
modules/simpletest/files/image-test-no-transparency.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 964 B |
@@ -11,6 +11,7 @@ configure = admin/config/development/testing/settings
|
||||
files[] = tests/actions.test
|
||||
files[] = tests/ajax.test
|
||||
files[] = tests/batch.test
|
||||
files[] = tests/boot.test
|
||||
files[] = tests/bootstrap.test
|
||||
files[] = tests/cache.test
|
||||
files[] = tests/common.test
|
||||
@@ -56,8 +57,8 @@ files[] = tests/upgrade/update.trigger.test
|
||||
files[] = tests/upgrade/update.field.test
|
||||
files[] = tests/upgrade/update.user.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -154,7 +154,7 @@ function simpletest_run_tests($test_list, $reporter = 'drupal') {
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch operation callback.
|
||||
* Implements callback_batch_operation().
|
||||
*/
|
||||
function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
|
||||
simpletest_classloader_register();
|
||||
@@ -205,6 +205,9 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
|
||||
$context['finished'] = 1 - $size / $max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_batch_finished().
|
||||
*/
|
||||
function _simpletest_batch_finished($success, $results, $operations, $elapsed) {
|
||||
if ($success) {
|
||||
drupal_set_message(t('The test run finished in @elapsed.', array('@elapsed' => $elapsed)));
|
||||
@@ -371,7 +374,10 @@ function simpletest_test_get_all() {
|
||||
// If this test class requires a non-existing module, skip it.
|
||||
if (!empty($info['dependencies'])) {
|
||||
foreach ($info['dependencies'] as $module) {
|
||||
if (!drupal_get_filename('module', $module)) {
|
||||
// Pass FALSE as fourth argument so no error gets created for
|
||||
// the missing file.
|
||||
$found_module = drupal_get_filename('module', $module, NULL, FALSE);
|
||||
if (!$found_module) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
@@ -509,25 +515,25 @@ function simpletest_registry_files_alter(&$files, $modules) {
|
||||
* Generate test file.
|
||||
*/
|
||||
function simpletest_generate_file($filename, $width, $lines, $type = 'binary-text') {
|
||||
$size = $width * $lines - $lines;
|
||||
|
||||
// Generate random text
|
||||
$text = '';
|
||||
for ($i = 0; $i < $size; $i++) {
|
||||
switch ($type) {
|
||||
case 'text':
|
||||
$text .= chr(rand(32, 126));
|
||||
break;
|
||||
case 'binary':
|
||||
$text .= chr(rand(0, 31));
|
||||
break;
|
||||
case 'binary-text':
|
||||
default:
|
||||
$text .= rand(0, 1);
|
||||
break;
|
||||
for ($i = 0; $i < $lines; $i++) {
|
||||
// Generate $width - 1 characters to leave space for the "\n" character.
|
||||
for ($j = 0; $j < $width - 1; $j++) {
|
||||
switch ($type) {
|
||||
case 'text':
|
||||
$text .= chr(rand(32, 126));
|
||||
break;
|
||||
case 'binary':
|
||||
$text .= chr(rand(0, 31));
|
||||
break;
|
||||
case 'binary-text':
|
||||
default:
|
||||
$text .= rand(0, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$text .= "\n";
|
||||
}
|
||||
$text = wordwrap($text, $width - 1, "\n", TRUE) . "\n"; // Add \n for symmetrical file.
|
||||
|
||||
// Create filename.
|
||||
file_put_contents('public://' . $filename . '.txt', $text);
|
||||
|
@@ -322,6 +322,14 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
|
||||
* Test internal testing framework browser.
|
||||
*/
|
||||
class SimpleTestBrowserTestCase extends DrupalWebTestCase {
|
||||
|
||||
/**
|
||||
* A flag indicating whether a cookie has been set in a test.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected static $cookieSet = FALSE;
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'SimpleTest browser',
|
||||
@@ -380,6 +388,46 @@ EOF;
|
||||
$urls = $this->xpath('//a[text()=:text]', array(':text' => 'A second "even more weird" link, in memory of George O\'Malley'));
|
||||
$this->assertEqual($urls[0]['href'], 'link2', 'Match with mixed single and double quotes.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that cookies set during a request are available for testing.
|
||||
*/
|
||||
public function testCookies() {
|
||||
// Check that the $this->cookies property is populated when a user logs in.
|
||||
$user = $this->drupalCreateUser();
|
||||
$edit = array('name' => $user->name, 'pass' => $user->pass_raw);
|
||||
$this->drupalPost('<front>', $edit, t('Log in'));
|
||||
$this->assertEqual(count($this->cookies), 1, 'A cookie is set when the user logs in.');
|
||||
|
||||
// Check that the name and value of the cookie match the request data.
|
||||
$cookie_header = $this->drupalGetHeader('set-cookie', TRUE);
|
||||
|
||||
// The name and value are located at the start of the string, separated by
|
||||
// an equals sign and ending in a semicolon.
|
||||
preg_match('/^([^=]+)=([^;]+)/', $cookie_header, $matches);
|
||||
$name = $matches[1];
|
||||
$value = $matches[2];
|
||||
|
||||
$this->assertTrue(array_key_exists($name, $this->cookies), 'The cookie name is correct.');
|
||||
$this->assertEqual($value, $this->cookies[$name]['value'], 'The cookie value is correct.');
|
||||
|
||||
// Set a flag indicating that a cookie has been set in this test.
|
||||
// @see SimpleTestBrowserTestCase::testCookieDoesNotBleed().
|
||||
self::$cookieSet = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the cookies from a previous test do not bleed into a new test.
|
||||
*
|
||||
* @see SimpleTestBrowserTestCase::testCookies().
|
||||
*/
|
||||
public function testCookieDoesNotBleed() {
|
||||
// In order for this test to be effective it should always run after the
|
||||
// testCookies() test.
|
||||
$this->assertTrue(self::$cookieSet, 'Tests have been executed in the expected order.');
|
||||
$this->assertEqual(count($this->cookies), 0, 'No cookies are present at the start of a new test.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SimpleTestMailCaptureTestCase extends DrupalWebTestCase {
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -7,6 +7,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements callback_batch_operation().
|
||||
*
|
||||
* Simple batch operation.
|
||||
*/
|
||||
function _batch_test_callback_1($id, $sleep, &$context) {
|
||||
@@ -20,6 +22,8 @@ function _batch_test_callback_1($id, $sleep, &$context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_batch_operation().
|
||||
*
|
||||
* Multistep batch operation.
|
||||
*/
|
||||
function _batch_test_callback_2($start, $total, $sleep, &$context) {
|
||||
@@ -53,6 +57,8 @@ function _batch_test_callback_2($start, $total, $sleep, &$context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_batch_operation().
|
||||
*
|
||||
* Simple batch operation.
|
||||
*/
|
||||
function _batch_test_callback_5($id, $sleep, &$context) {
|
||||
@@ -68,6 +74,8 @@ function _batch_test_callback_5($id, $sleep, &$context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_batch_operation().
|
||||
*
|
||||
* Batch operation setting up its own batch.
|
||||
*/
|
||||
function _batch_test_nested_batch_callback() {
|
||||
@@ -76,6 +84,8 @@ function _batch_test_nested_batch_callback() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_batch_finished().
|
||||
*
|
||||
* Common 'finished' callbacks for batches 1 to 4.
|
||||
*/
|
||||
function _batch_test_finished_helper($batch_id, $success, $results, $operations) {
|
||||
@@ -99,6 +109,8 @@ function _batch_test_finished_helper($batch_id, $success, $results, $operations)
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_batch_finished().
|
||||
*
|
||||
* 'finished' callback for batch 0.
|
||||
*/
|
||||
function _batch_test_finished_0($success, $results, $operations) {
|
||||
@@ -106,6 +118,8 @@ function _batch_test_finished_0($success, $results, $operations) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_batch_finished().
|
||||
*
|
||||
* 'finished' callback for batch 1.
|
||||
*/
|
||||
function _batch_test_finished_1($success, $results, $operations) {
|
||||
@@ -113,6 +127,8 @@ function _batch_test_finished_1($success, $results, $operations) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_batch_finished().
|
||||
*
|
||||
* 'finished' callback for batch 2.
|
||||
*/
|
||||
function _batch_test_finished_2($success, $results, $operations) {
|
||||
@@ -120,6 +136,8 @@ function _batch_test_finished_2($success, $results, $operations) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_batch_finished().
|
||||
*
|
||||
* 'finished' callback for batch 3.
|
||||
*/
|
||||
function _batch_test_finished_3($success, $results, $operations) {
|
||||
@@ -127,6 +145,8 @@ function _batch_test_finished_3($success, $results, $operations) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_batch_finished().
|
||||
*
|
||||
* 'finished' callback for batch 4.
|
||||
*/
|
||||
function _batch_test_finished_4($success, $results, $operations) {
|
||||
@@ -134,6 +154,8 @@ function _batch_test_finished_4($success, $results, $operations) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_batch_finished().
|
||||
*
|
||||
* 'finished' callback for batch 5.
|
||||
*/
|
||||
function _batch_test_finished_5($success, $results, $operations) {
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
38
modules/simpletest/tests/boot.test
Normal file
38
modules/simpletest/tests/boot.test
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Perform early bootstrap tests.
|
||||
*/
|
||||
class EarlyBootstrapTestCase extends DrupalWebTestCase {
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Early bootstrap test',
|
||||
'description' => 'Confirm that calling module_implements() during early bootstrap does not pollute the module_implements() cache.',
|
||||
'group' => 'System',
|
||||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp('boot_test_1', 'boot_test_2');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test hook_boot() on both regular and "early exit" pages.
|
||||
*/
|
||||
public function testHookBoot() {
|
||||
$paths = array('', 'early_exit');
|
||||
foreach ($paths as $path) {
|
||||
// Empty the module_implements() caches.
|
||||
module_implements(NULL, FALSE, TRUE);
|
||||
// Do a request to the front page, which will call module_implements()
|
||||
// during hook_boot().
|
||||
$this->drupalGet($path);
|
||||
// Reset the static cache so we get implementation data from the persistent
|
||||
// cache.
|
||||
drupal_static_reset();
|
||||
// Make sure we get a full list of all modules implementing hook_help().
|
||||
$modules = module_implements('help');
|
||||
$this->assertTrue(in_array('boot_test_2', $modules));
|
||||
}
|
||||
}
|
||||
}
|
12
modules/simpletest/tests/boot_test_1.info
Normal file
12
modules/simpletest/tests/boot_test_1.info
Normal file
@@ -0,0 +1,12 @@
|
||||
name = Early bootstrap tests
|
||||
description = A support module for hook_boot testing.
|
||||
core = 7.x
|
||||
package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1475694174"
|
||||
|
21
modules/simpletest/tests/boot_test_1.module
Normal file
21
modules/simpletest/tests/boot_test_1.module
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Tests calling module_implements() during hook_boot() invocation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_boot().
|
||||
*/
|
||||
function boot_test_1_boot() {
|
||||
// Calling module_implements during hook_boot() will return "vital" modules
|
||||
// only, and this list of modules will be statically cached.
|
||||
module_implements('help');
|
||||
// Define a special path to test that the static cache isn't written away
|
||||
// if we exit before having completed the bootstrap.
|
||||
if ($_GET['q'] == 'early_exit') {
|
||||
module_implements_write_cache();
|
||||
exit();
|
||||
}
|
||||
}
|
12
modules/simpletest/tests/boot_test_2.info
Normal file
12
modules/simpletest/tests/boot_test_2.info
Normal file
@@ -0,0 +1,12 @@
|
||||
name = Early bootstrap tests
|
||||
description = A support module for hook_boot hook testing.
|
||||
core = 7.x
|
||||
package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1475694174"
|
||||
|
13
modules/simpletest/tests/boot_test_2.module
Normal file
13
modules/simpletest/tests/boot_test_2.module
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Defines a hook_help() implementation in a non-"bootstrap" module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
*/
|
||||
function boot_test_2_help($path, $arg) {
|
||||
// Empty hook.
|
||||
}
|
@@ -70,6 +70,15 @@ class BootstrapIPAddressTestCase extends DrupalWebTestCase {
|
||||
'Proxy forwarding with trusted proxy got forwarded IP address.'
|
||||
);
|
||||
|
||||
// Proxy forwarding on and proxy address trusted and visiting from proxy.
|
||||
$_SERVER['REMOTE_ADDR'] = $this->proxy_ip;
|
||||
$_SERVER['HTTP_X_FORWARDED_FOR'] = $this->proxy_ip;
|
||||
drupal_static_reset('ip_address');
|
||||
$this->assertTrue(
|
||||
ip_address() == $this->proxy_ip,
|
||||
'Visiting from trusted proxy got proxy IP address.'
|
||||
);
|
||||
|
||||
// Multi-tier architecture with comma separated values in header.
|
||||
$_SERVER['REMOTE_ADDR'] = $this->proxy_ip;
|
||||
$_SERVER['HTTP_X_FORWARDED_FOR'] = implode(', ', array($this->untrusted_ip, $this->forwarded_ip, $this->proxy2_ip));
|
||||
@@ -152,7 +161,7 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
|
||||
$this->drupalLogin($user);
|
||||
$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('X-Drupal-Cache'), 'Absence 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.');
|
||||
}
|
||||
@@ -191,7 +200,7 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
|
||||
$this->drupalGet('system-test/set-header', array('query' => array('name' => 'Foo', 'value' => 'bar')));
|
||||
$this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), 'Caching was bypassed.');
|
||||
$this->assertTrue(strpos($this->drupalGetHeader('Vary'), 'Cookie') === FALSE, 'Vary: Cookie header was not sent.');
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'no-cache, must-revalidate, post-check=0, pre-check=0', 'Cache-Control header was sent.');
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'no-cache, must-revalidate', 'Cache-Control header was sent.');
|
||||
$this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.');
|
||||
$this->assertEqual($this->drupalGetHeader('Foo'), 'bar', 'Custom header was sent.');
|
||||
|
||||
@@ -313,6 +322,10 @@ class BootstrapAutoloadTestCase extends DrupalWebTestCase {
|
||||
$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 trait autoloader.
|
||||
if (version_compare(PHP_VERSION, '5.4') >= 0) {
|
||||
$this->assertTrue(drupal_autoload_trait('drupalautoloadtesttrait'), 'drupal_autoload_trait() recognizes <em>DrupalAutoloadTestTrait</em> in lower case.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -375,12 +388,19 @@ class BootstrapGetFilenameTestCase extends DrupalUnitTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Get filename test',
|
||||
'description' => 'Test that drupal_get_filename() works correctly when the file is not found in the database.',
|
||||
'name' => 'Get filename test (without the system table)',
|
||||
'description' => 'Test that drupal_get_filename() works correctly when the database is not available.',
|
||||
'group' => 'Bootstrap',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The last file-related error message triggered by the filename test.
|
||||
*
|
||||
* Used by BootstrapGetFilenameTestCase::testDrupalGetFilename().
|
||||
*/
|
||||
protected $getFilenameTestTriggeredError;
|
||||
|
||||
/**
|
||||
* Test that drupal_get_filename() works correctly when the file is not found in the database.
|
||||
*/
|
||||
@@ -410,6 +430,203 @@ class BootstrapGetFilenameTestCase extends DrupalUnitTestCase {
|
||||
// automatically check there for 'script' files, just as it does for (e.g.)
|
||||
// 'module' files in modules.
|
||||
$this->assertIdentical(drupal_get_filename('script', 'test'), 'scripts/test.script', t('Retrieve test script location.'));
|
||||
|
||||
// When searching for a module that does not exist, drupal_get_filename()
|
||||
// should return NULL and trigger an appropriate error message.
|
||||
$this->getFilenameTestTriggeredError = NULL;
|
||||
set_error_handler(array($this, 'fileNotFoundErrorHandler'));
|
||||
$non_existing_module = $this->randomName();
|
||||
$this->assertNull(drupal_get_filename('module', $non_existing_module), 'Searching for a module that does not exist returns NULL.');
|
||||
$this->assertTrue(strpos($this->getFilenameTestTriggeredError, format_string('The following module is missing from the file system: %name', array('%name' => $non_existing_module))) === 0, 'Searching for an item that does not exist triggers the correct error.');
|
||||
restore_error_handler();
|
||||
|
||||
// Check that the result is stored in the file system scan cache.
|
||||
$file_scans = _drupal_file_scan_cache();
|
||||
$this->assertIdentical($file_scans['module'][$non_existing_module], FALSE, 'Searching for a module that does not exist creates a record in the missing and moved files static variable.');
|
||||
|
||||
// Performing the search again in the same request still should not find
|
||||
// the file, but the error message should not be repeated (therefore we do
|
||||
// not override the error handler here).
|
||||
$this->assertNull(drupal_get_filename('module', $non_existing_module), 'Searching for a module that does not exist returns NULL during the second search.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Skips handling of "file not found" errors.
|
||||
*/
|
||||
public function fileNotFoundErrorHandler($error_level, $message, $filename, $line, $context) {
|
||||
// Skip error handling if this is a "file not found" error.
|
||||
if (strpos($message, 'is missing from the file system:') !== FALSE || strpos($message, 'has moved within the file system:') !== FALSE) {
|
||||
$this->getFilenameTestTriggeredError = $message;
|
||||
return;
|
||||
}
|
||||
_drupal_error_handler($error_level, $message, $filename, $line, $context);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test drupal_get_filename() in the context of a full Drupal installation.
|
||||
*/
|
||||
class BootstrapGetFilenameWebTestCase extends DrupalWebTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Get filename test (full installation)',
|
||||
'description' => 'Test that drupal_get_filename() works correctly in the context of a full Drupal installation.',
|
||||
'group' => 'Bootstrap',
|
||||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp('system_test');
|
||||
}
|
||||
|
||||
/**
|
||||
* The last file-related error message triggered by the filename test.
|
||||
*
|
||||
* Used by BootstrapGetFilenameWebTestCase::testDrupalGetFilename().
|
||||
*/
|
||||
protected $getFilenameTestTriggeredError;
|
||||
|
||||
/**
|
||||
* Test that drupal_get_filename() works correctly with a full Drupal site.
|
||||
*/
|
||||
function testDrupalGetFilename() {
|
||||
// Search for a module that exists in the file system and the {system}
|
||||
// table and make sure that it is found.
|
||||
$this->assertIdentical(drupal_get_filename('module', 'node'), 'modules/node/node.module', 'Module found at expected location.');
|
||||
|
||||
// Search for a module that does not exist in either the file system or the
|
||||
// {system} table. Make sure that an appropriate error is triggered and
|
||||
// that the module winds up in the static and persistent cache.
|
||||
$this->getFilenameTestTriggeredError = NULL;
|
||||
set_error_handler(array($this, 'fileNotFoundErrorHandler'));
|
||||
$non_existing_module = $this->randomName();
|
||||
$this->assertNull(drupal_get_filename('module', $non_existing_module), 'Searching for a module that does not exist returns NULL.');
|
||||
$this->assertTrue(strpos($this->getFilenameTestTriggeredError, format_string('The following module is missing from the file system: %name', array('%name' => $non_existing_module))) === 0, 'Searching for a module that does not exist triggers the correct error.');
|
||||
restore_error_handler();
|
||||
$file_scans = _drupal_file_scan_cache();
|
||||
$this->assertIdentical($file_scans['module'][$non_existing_module], FALSE, 'Searching for a module that does not exist creates a record in the missing and moved files static variable.');
|
||||
drupal_file_scan_write_cache();
|
||||
$cache = cache_get('_drupal_file_scan_cache', 'cache_bootstrap');
|
||||
$this->assertIdentical($cache->data['module'][$non_existing_module], FALSE, 'Searching for a module that does not exist creates a record in the missing and moved files persistent cache.');
|
||||
|
||||
// Simulate moving a module to a location that does not match the location
|
||||
// in the {system} table and perform similar tests as above.
|
||||
db_update('system')
|
||||
->fields(array('filename' => 'modules/simpletest/tests/fake_location/module_test.module'))
|
||||
->condition('name', 'module_test')
|
||||
->condition('type', 'module')
|
||||
->execute();
|
||||
$this->getFilenameTestTriggeredError = NULL;
|
||||
set_error_handler(array($this, 'fileNotFoundErrorHandler'));
|
||||
$this->assertIdentical(drupal_get_filename('module', 'module_test'), 'modules/simpletest/tests/module_test.module', 'Searching for a module that has moved finds the module at its new location.');
|
||||
$this->assertTrue(strpos($this->getFilenameTestTriggeredError, format_string('The following module has moved within the file system: %name', array('%name' => 'module_test'))) === 0, 'Searching for a module that has moved triggers the correct error.');
|
||||
restore_error_handler();
|
||||
$file_scans = _drupal_file_scan_cache();
|
||||
$this->assertIdentical($file_scans['module']['module_test'], 'modules/simpletest/tests/module_test.module', 'Searching for a module that has moved creates a record in the missing and moved files static variable.');
|
||||
drupal_file_scan_write_cache();
|
||||
$cache = cache_get('_drupal_file_scan_cache', 'cache_bootstrap');
|
||||
$this->assertIdentical($cache->data['module']['module_test'], 'modules/simpletest/tests/module_test.module', 'Searching for a module that has moved creates a record in the missing and moved files persistent cache.');
|
||||
|
||||
// Simulate a module that exists in the {system} table but does not exist
|
||||
// in the file system and perform similar tests as above.
|
||||
$non_existing_module = $this->randomName();
|
||||
db_update('system')
|
||||
->fields(array('name' => $non_existing_module))
|
||||
->condition('name', 'module_test')
|
||||
->condition('type', 'module')
|
||||
->execute();
|
||||
$this->getFilenameTestTriggeredError = NULL;
|
||||
set_error_handler(array($this, 'fileNotFoundErrorHandler'));
|
||||
$this->assertNull(drupal_get_filename('module', $non_existing_module), 'Searching for a module that exists in the system table but not in the file system returns NULL.');
|
||||
$this->assertTrue(strpos($this->getFilenameTestTriggeredError, format_string('The following module is missing from the file system: %name', array('%name' => $non_existing_module))) === 0, 'Searching for a module that exists in the system table but not in the file system triggers the correct error.');
|
||||
restore_error_handler();
|
||||
$file_scans = _drupal_file_scan_cache();
|
||||
$this->assertIdentical($file_scans['module'][$non_existing_module], FALSE, 'Searching for a module that exists in the system table but not in the file system creates a record in the missing and moved files static variable.');
|
||||
drupal_file_scan_write_cache();
|
||||
$cache = cache_get('_drupal_file_scan_cache', 'cache_bootstrap');
|
||||
$this->assertIdentical($cache->data['module'][$non_existing_module], FALSE, 'Searching for a module that exists in the system table but not in the file system creates a record in the missing and moved files persistent cache.');
|
||||
|
||||
// Simulate a module that exists in the file system but not in the {system}
|
||||
// table and perform similar tests as above.
|
||||
db_delete('system')
|
||||
->condition('name', 'common_test')
|
||||
->condition('type', 'module')
|
||||
->execute();
|
||||
system_list_reset();
|
||||
$this->getFilenameTestTriggeredError = NULL;
|
||||
set_error_handler(array($this, 'fileNotFoundErrorHandler'));
|
||||
$this->assertIdentical(drupal_get_filename('module', 'common_test'), 'modules/simpletest/tests/common_test.module', 'Searching for a module that does not exist in the system table finds the module at its actual location.');
|
||||
$this->assertTrue(strpos($this->getFilenameTestTriggeredError, format_string('The following module has moved within the file system: %name', array('%name' => 'common_test'))) === 0, 'Searching for a module that does not exist in the system table triggers the correct error.');
|
||||
restore_error_handler();
|
||||
$file_scans = _drupal_file_scan_cache();
|
||||
$this->assertIdentical($file_scans['module']['common_test'], 'modules/simpletest/tests/common_test.module', 'Searching for a module that does not exist in the system table creates a record in the missing and moved files static variable.');
|
||||
drupal_file_scan_write_cache();
|
||||
$cache = cache_get('_drupal_file_scan_cache', 'cache_bootstrap');
|
||||
$this->assertIdentical($cache->data['module']['common_test'], 'modules/simpletest/tests/common_test.module', 'Searching for a module that does not exist in the system table creates a record in the missing and moved files persistent cache.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Skips handling of "file not found" errors.
|
||||
*/
|
||||
public function fileNotFoundErrorHandler($error_level, $message, $filename, $line, $context) {
|
||||
// Skip error handling if this is a "file not found" error.
|
||||
if (strpos($message, 'is missing from the file system:') !== FALSE || strpos($message, 'has moved within the file system:') !== FALSE) {
|
||||
$this->getFilenameTestTriggeredError = $message;
|
||||
return;
|
||||
}
|
||||
_drupal_error_handler($error_level, $message, $filename, $line, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that watchdog messages about missing files are correctly recorded.
|
||||
*/
|
||||
public function testWatchdog() {
|
||||
// Search for a module that does not exist in either the file system or the
|
||||
// {system} table. Make sure that an appropriate warning is recorded in the
|
||||
// logs.
|
||||
$non_existing_module = $this->randomName();
|
||||
$query_parameters = array(
|
||||
':type' => 'php',
|
||||
':severity' => WATCHDOG_WARNING,
|
||||
);
|
||||
$this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND severity = :severity', $query_parameters)->fetchField(), 0, 'No warning message appears in the logs before searching for a module that does not exist.');
|
||||
// Trigger the drupal_get_filename() call. This must be done via a request
|
||||
// to a separate URL since the watchdog() will happen in a shutdown
|
||||
// function, and so that SimpleTest can be told to ignore (and not fail as
|
||||
// a result of) the expected PHP warnings generated during this process.
|
||||
variable_set('system_test_drupal_get_filename_test_module_name', $non_existing_module);
|
||||
$this->drupalGet('system-test/drupal-get-filename');
|
||||
$message_variables = db_query('SELECT variables FROM {watchdog} WHERE type = :type AND severity = :severity', $query_parameters)->fetchCol();
|
||||
$this->assertEqual(count($message_variables), 1, 'A single warning message appears in the logs after searching for a module that does not exist.');
|
||||
$variables = reset($message_variables);
|
||||
$variables = unserialize($variables);
|
||||
$this->assertTrue(isset($variables['!message']) && strpos($variables['!message'], format_string('The following module is missing from the file system: %name', array('%name' => $non_existing_module))) !== FALSE, 'The warning message that appears in the logs after searching for a module that does not exist contains the expected text.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that drupal_get_filename() does not break recursive rebuilds.
|
||||
*/
|
||||
public function testRecursiveRebuilds() {
|
||||
// Ensure that the drupal_get_filename() call due to a missing module does
|
||||
// not break the data returned by an attempted recursive rebuild. The code
|
||||
// path which is tested is as follows:
|
||||
// - Call drupal_get_schema().
|
||||
// - Within a hook_schema() implementation, trigger a drupal_get_filename()
|
||||
// search for a nonexistent module.
|
||||
// - In the watchdog() call that results from that, trigger
|
||||
// drupal_get_schema() again.
|
||||
// Without some kind of recursion protection, this could cause the second
|
||||
// drupal_get_schema() call to return incomplete results. This test ensures
|
||||
// that does not happen.
|
||||
$non_existing_module = $this->randomName();
|
||||
variable_set('system_test_drupal_get_filename_test_module_name', $non_existing_module);
|
||||
$this->drupalGet('system-test/drupal-get-filename-with-schema-rebuild');
|
||||
$original_drupal_get_schema_tables = variable_get('system_test_drupal_get_filename_with_schema_rebuild_original_tables');
|
||||
$final_drupal_get_schema_tables = variable_get('system_test_drupal_get_filename_with_schema_rebuild_final_tables');
|
||||
$this->assertTrue(!empty($original_drupal_get_schema_tables));
|
||||
$this->assertTrue(!empty($final_drupal_get_schema_tables));
|
||||
$this->assertEqual($original_drupal_get_schema_tables, $final_drupal_get_schema_tables);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -372,6 +372,65 @@ class CommonURLUnitTest extends DrupalWebTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests url_is_external().
|
||||
*/
|
||||
class UrlIsExternalUnitTest extends DrupalUnitTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'External URL checking',
|
||||
'description' => 'Performs tests on url_is_external().',
|
||||
'group' => 'System',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if each URL is external or not.
|
||||
*/
|
||||
function testUrlIsExternal() {
|
||||
foreach ($this->examples() as $path => $expected) {
|
||||
$this->assertIdentical(url_is_external($path), $expected, $path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides data for testUrlIsExternal().
|
||||
*
|
||||
* @return array
|
||||
* An array of test data, keyed by a path, with the expected value where
|
||||
* TRUE is external, and FALSE is not external.
|
||||
*/
|
||||
protected function examples() {
|
||||
return array(
|
||||
// Simple external URLs.
|
||||
'http://example.com' => TRUE,
|
||||
'https://example.com' => TRUE,
|
||||
'http://drupal.org/foo/bar?foo=bar&bar=baz&baz#foo' => TRUE,
|
||||
'//drupal.org' => TRUE,
|
||||
// Some browsers ignore or strip leading control characters.
|
||||
"\x00//www.example.com" => TRUE,
|
||||
"\x08//www.example.com" => TRUE,
|
||||
"\x1F//www.example.com" => TRUE,
|
||||
"\n//www.example.com" => TRUE,
|
||||
// JSON supports decoding directly from UTF-8 code points.
|
||||
json_decode('"\u00AD"') . "//www.example.com" => TRUE,
|
||||
json_decode('"\u200E"') . "//www.example.com" => TRUE,
|
||||
json_decode('"\uE0020"') . "//www.example.com" => TRUE,
|
||||
json_decode('"\uE000"') . "//www.example.com" => TRUE,
|
||||
// Backslashes should be normalized to forward.
|
||||
'\\\\example.com' => TRUE,
|
||||
// Local URLs.
|
||||
'node' => FALSE,
|
||||
'/system/ajax' => FALSE,
|
||||
'?q=foo:bar' => FALSE,
|
||||
'node/edit:me' => FALSE,
|
||||
'/drupal.org' => FALSE,
|
||||
'<front>' => FALSE,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for check_plain(), filter_xss(), format_string(), and check_url().
|
||||
*/
|
||||
@@ -888,6 +947,31 @@ class DrupalHTMLIdentifierTestCase extends DrupalUnitTestCase {
|
||||
|
||||
// Verify that invalid characters (including non-breaking space) are stripped from the identifier.
|
||||
$this->assertIdentical(drupal_clean_css_identifier('invalid !"#$%&\'()*+,./:;<=>?@[\\]^`{|}~ identifier', array()), 'invalididentifier', 'Strip invalid characters.');
|
||||
|
||||
// Verify that double underscores are replaced in the identifier by default.
|
||||
$identifier = 'css__identifier__with__double__underscores';
|
||||
$expected = 'css--identifier--with--double--underscores';
|
||||
$this->assertIdentical(drupal_clean_css_identifier($identifier), $expected, 'Verify double underscores are replaced with double hyphens by default.');
|
||||
|
||||
// Verify that double underscores are preserved in the identifier if the
|
||||
// variable allow_css_double_underscores is set to TRUE.
|
||||
$this->setAllowCSSDoubleUnderscores(TRUE);
|
||||
$this->assertIdentical(drupal_clean_css_identifier($identifier), $identifier, 'Verify double underscores are preserved if the allow_css_double_underscores set to TRUE.');
|
||||
|
||||
// To avoid affecting other test cases, set the variable
|
||||
// allow_css_double_underscores to FALSE which is the default value.
|
||||
$this->setAllowCSSDoubleUnderscores(FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the variable allow_css_double_underscores and reset the cache.
|
||||
*
|
||||
* @param $value bool
|
||||
* A new value to be set to allow_css_double_underscores.
|
||||
*/
|
||||
function setAllowCSSDoubleUnderscores($value) {
|
||||
$GLOBALS['conf']['allow_css_double_underscores'] = $value;
|
||||
drupal_static_reset('drupal_clean_css_identifier:allow_css_double_underscores');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -942,6 +1026,7 @@ class CascadingStylesheetsUnitTest extends DrupalUnitTestCase {
|
||||
* - 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)
|
||||
* - Files imported from external URLs. (https://drupal.org/node/2014851)
|
||||
*/
|
||||
function testLoadCssBasic() {
|
||||
// Array of files to test living in 'simpletest/files/css_test_files/'.
|
||||
@@ -1194,7 +1279,7 @@ class DrupalSetContentTestCase extends DrupalWebTestCase {
|
||||
function testRegions() {
|
||||
global $theme_key;
|
||||
|
||||
$block_regions = array_keys(system_region_list($theme_key));
|
||||
$block_regions = system_region_list($theme_key, REGIONS_ALL, FALSE);
|
||||
$delimiter = $this->randomName(32);
|
||||
$values = array();
|
||||
// Set some random content for each region available.
|
||||
@@ -1255,6 +1340,15 @@ class DrupalGotoTest extends DrupalWebTestCase {
|
||||
$this->assertText('drupal_goto', 'Drupal goto redirect succeeded.');
|
||||
$this->assertEqual($this->getUrl(), url('common-test/drupal_goto', array('query' => array('foo' => '123'), 'absolute' => TRUE)), 'Drupal goto redirected to expected URL.');
|
||||
|
||||
// Test that calling drupal_goto() on the current path is not dangerous.
|
||||
variable_set('common_test_redirect_current_path', TRUE);
|
||||
$this->drupalGet('', array('query' => array('q' => 'http://www.example.com/')));
|
||||
$headers = $this->drupalGetHeaders(TRUE);
|
||||
list(, $status) = explode(' ', $headers[0][':status'], 3);
|
||||
$this->assertEqual($status, 302, 'Expected response code was sent.');
|
||||
$this->assertNotEqual($this->getUrl(), 'http://www.example.com/', 'Drupal goto did not redirect to external URL.');
|
||||
$this->assertTrue(strpos($this->getUrl(), url('<front>', array('absolute' => TRUE))) === 0, 'Drupal redirected to itself.');
|
||||
variable_del('common_test_redirect_current_path');
|
||||
// Test that drupal_goto() respects ?destination=xxx. Use an complicated URL
|
||||
// to test that the path is encoded and decoded properly.
|
||||
$destination = 'common-test/drupal_goto/destination?foo=%2525&bar=123';
|
||||
@@ -2116,7 +2210,7 @@ class DrupalRenderTestCase extends DrupalWebTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests caching of an empty render item.
|
||||
* Tests caching of render items.
|
||||
*/
|
||||
function testDrupalRenderCache() {
|
||||
// Force a request via GET.
|
||||
@@ -2142,6 +2236,59 @@ class DrupalRenderTestCase extends DrupalWebTestCase {
|
||||
drupal_render($element);
|
||||
$this->assertFalse(isset($element['#printed']), 'Cache hit');
|
||||
|
||||
// Test that user 1 does not share the cache with other users who have the
|
||||
// same roles, even when DRUPAL_CACHE_PER_ROLE is used.
|
||||
$user1 = user_load(1);
|
||||
$first_authenticated_user = $this->drupalCreateUser();
|
||||
$second_authenticated_user = $this->drupalCreateUser();
|
||||
$user1->roles = array_intersect_key($user1->roles, array(DRUPAL_AUTHENTICATED_RID => TRUE));
|
||||
user_save($user1);
|
||||
// Load all the accounts again, to make sure we have complete account
|
||||
// objects.
|
||||
$user1 = user_load(1);
|
||||
$first_authenticated_user = user_load($first_authenticated_user->uid);
|
||||
$second_authenticated_user = user_load($second_authenticated_user->uid);
|
||||
$this->assertEqual($user1->roles, $first_authenticated_user->roles, 'User 1 has the same roles as an authenticated user.');
|
||||
// Impersonate user 1 and render content that only user 1 should have
|
||||
// permission to see.
|
||||
$original_user = $GLOBALS['user'];
|
||||
$original_session_state = drupal_save_session();
|
||||
drupal_save_session(FALSE);
|
||||
$GLOBALS['user'] = $user1;
|
||||
$test_element = array(
|
||||
'#cache' => array(
|
||||
'keys' => array('test'),
|
||||
'granularity' => DRUPAL_CACHE_PER_ROLE,
|
||||
),
|
||||
);
|
||||
$element = $test_element;
|
||||
$element['#markup'] = 'content for user 1';
|
||||
$output = drupal_render($element);
|
||||
$this->assertEqual($output, 'content for user 1');
|
||||
// Verify the cache is working by rendering the same element but with
|
||||
// different markup passed in; the result should be the same.
|
||||
$element = $test_element;
|
||||
$element['#markup'] = 'should not be used';
|
||||
$output = drupal_render($element);
|
||||
$this->assertEqual($output, 'content for user 1');
|
||||
// Verify that the first authenticated user does not see the same content
|
||||
// as user 1.
|
||||
$GLOBALS['user'] = $first_authenticated_user;
|
||||
$element = $test_element;
|
||||
$element['#markup'] = 'content for authenticated users';
|
||||
$output = drupal_render($element);
|
||||
$this->assertEqual($output, 'content for authenticated users');
|
||||
// Verify that the second authenticated user shares the cache with the
|
||||
// first authenticated user.
|
||||
$GLOBALS['user'] = $second_authenticated_user;
|
||||
$element = $test_element;
|
||||
$element['#markup'] = 'should not be used';
|
||||
$output = drupal_render($element);
|
||||
$this->assertEqual($output, 'content for authenticated users');
|
||||
// Restore the original logged-in user.
|
||||
$GLOBALS['user'] = $original_user;
|
||||
drupal_save_session($original_session_state);
|
||||
|
||||
// Restore the previous request method.
|
||||
$_SERVER['REQUEST_METHOD'] = $request_method;
|
||||
}
|
||||
|
@@ -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 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -92,6 +92,15 @@ function common_test_drupal_goto_alter(&$path, &$options, &$http_response_code)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_init().
|
||||
*/
|
||||
function common_test_init() {
|
||||
if (variable_get('common_test_redirect_current_path', FALSE)) {
|
||||
drupal_goto(current_path());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print destination query parameter.
|
||||
*/
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -1414,10 +1414,47 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
|
||||
}
|
||||
|
||||
$query = (string)$query;
|
||||
$expected = "/* Testing query comments SELECT nid FROM {node}; -- */ SELECT test.name AS name, test.age AS age\nFROM \n{test} test";
|
||||
$expected = "/* Testing query comments * / SELECT nid FROM {node}; -- */ SELECT test.name AS name, test.age AS age\nFROM \n{test} test";
|
||||
|
||||
$this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
|
||||
$this->assertEqual($query, $expected, 'The flattened query contains the sanitised comment string.');
|
||||
|
||||
$connection = Database::getConnection();
|
||||
foreach ($this->makeCommentsProvider() as $test_set) {
|
||||
list($expected, $comments) = $test_set;
|
||||
$this->assertEqual($expected, $connection->makeComment($comments));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides expected and input values for testVulnerableComment().
|
||||
*/
|
||||
function makeCommentsProvider() {
|
||||
return array(
|
||||
array(
|
||||
'/* */ ',
|
||||
array(''),
|
||||
),
|
||||
// Try and close the comment early.
|
||||
array(
|
||||
'/* Exploit * / DROP TABLE node; -- */ ',
|
||||
array('Exploit */ DROP TABLE node; --'),
|
||||
),
|
||||
// Variations on comment closing.
|
||||
array(
|
||||
'/* Exploit * / * / DROP TABLE node; -- */ ',
|
||||
array('Exploit */*/ DROP TABLE node; --'),
|
||||
),
|
||||
array(
|
||||
'/* Exploit * * // DROP TABLE node; -- */ ',
|
||||
array('Exploit **// DROP TABLE node; --'),
|
||||
),
|
||||
// Try closing the comment in the second string which is appended.
|
||||
array(
|
||||
'/* Exploit * / DROP TABLE node; --; Another try * / DROP TABLE node; -- */ ',
|
||||
array('Exploit */ DROP TABLE node; --', 'Another try */ DROP TABLE node; --'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -7,8 +7,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -4,3 +4,19 @@
|
||||
* @file
|
||||
* Test module to check code registry.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_registry_files_alter().
|
||||
*/
|
||||
function drupal_autoload_test_registry_files_alter(&$files, $modules) {
|
||||
foreach ($modules as $module) {
|
||||
// Add the drupal_autoload_test_trait.sh file to the registry when PHP 5.4+
|
||||
// is being used.
|
||||
if ($module->name == 'drupal_autoload_test' && version_compare(PHP_VERSION, '5.4') >= 0) {
|
||||
$files["$module->dir/drupal_autoload_test_trait.sh"] = array(
|
||||
'module' => $module->name,
|
||||
'weight' => $module->weight,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Test traits for code registry testing.
|
||||
*
|
||||
* This file has a non-standard extension to prevent PHP < 5.4 testbots from
|
||||
* trying to run a syntax check on it.
|
||||
* @todo Use a standard extension once the testbots allow it. See
|
||||
* https://www.drupal.org/node/2589649.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This trait is empty because we only care if Drupal can find it.
|
||||
*/
|
||||
trait DrupalAutoloadTestTrait {}
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = entity_cache_test_dependency
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -480,13 +480,6 @@ class FileValidatorTest extends DrupalWebTestCase {
|
||||
* Test file_validate_size().
|
||||
*/
|
||||
function testFileValidateSize() {
|
||||
global $user;
|
||||
$original_user = $user;
|
||||
drupal_save_session(FALSE);
|
||||
|
||||
// Run these tests as a regular user.
|
||||
$user = $this->drupalCreateUser();
|
||||
|
||||
// Create a file with a size of 1000 bytes, and quotas of only 1 byte.
|
||||
$file = new stdClass();
|
||||
$file->filesize = 1000;
|
||||
@@ -498,9 +491,6 @@ class FileValidatorTest extends DrupalWebTestCase {
|
||||
$this->assertEqual(count($errors), 1, 'Error for the user being over their limit.', 'File');
|
||||
$errors = file_validate_size($file, 1, 1);
|
||||
$this->assertEqual(count($errors), 2, 'Errors for both the file and their limit.', 'File');
|
||||
|
||||
$user = $original_user;
|
||||
drupal_save_session(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = file_test.module
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -994,6 +994,26 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
|
||||
$this->assertTrue(isset($errors['tableselect']), 'Option checker disallows invalid values for radio buttons.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test presence of ajax functionality
|
||||
*/
|
||||
function testAjax() {
|
||||
$rows = array('row1', 'row2', 'row3');
|
||||
// Test checkboxes (#multiple == TRUE).
|
||||
foreach ($rows as $row) {
|
||||
$element = 'tableselect[' . $row . ']';
|
||||
$edit = array($element => TRUE);
|
||||
$result = $this->drupalPostAJAX('form_test/tableselect/multiple-true', $edit, $element);
|
||||
$this->assertFalse(empty($result), t('Ajax triggers on checkbox for @row.', array('@row' => $row)));
|
||||
}
|
||||
// Test radios (#multiple == FALSE).
|
||||
$element = 'tableselect';
|
||||
foreach ($rows as $row) {
|
||||
$edit = array($element => $row);
|
||||
$result = $this->drupalPostAjax('form_test/tableselect/multiple-false', $edit, $element);
|
||||
$this->assertFalse(empty($result), t('Ajax triggers on radio for @row.', array('@row' => $row)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for the option check test to submit a form while collecting errors.
|
||||
@@ -2099,3 +2119,36 @@ class HTMLIdTestCase extends DrupalWebTestCase {
|
||||
$this->assertNoDuplicateIds('There are no duplicate IDs');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for form textarea.
|
||||
*/
|
||||
class FormTextareaTestCase extends DrupalUnitTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Form textarea',
|
||||
'description' => 'Tests form textarea related functions.',
|
||||
'group' => 'Form API',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that textarea value is properly set.
|
||||
*/
|
||||
public function testValueCallback() {
|
||||
$element = array();
|
||||
$form_state = array();
|
||||
$test_cases = array(
|
||||
array(NULL, FALSE),
|
||||
array(NULL, NULL),
|
||||
array('', array('test')),
|
||||
array('test', 'test'),
|
||||
array('123', 123),
|
||||
);
|
||||
foreach ($test_cases as $test_case) {
|
||||
list($expected, $input) = $test_case;
|
||||
$this->assertIdentical($expected, form_type_textarea_value($element, $input, $form_state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -589,11 +589,17 @@ function _form_test_tableselect_form_builder($form, $form_state, $element_proper
|
||||
$form['tableselect'] = $element_properties;
|
||||
|
||||
$form['tableselect'] += array(
|
||||
'#prefix' => '<div id="tableselect-wrapper">',
|
||||
'#suffix' => '</div>',
|
||||
'#type' => 'tableselect',
|
||||
'#header' => $header,
|
||||
'#options' => $options,
|
||||
'#multiple' => FALSE,
|
||||
'#empty' => t('Empty text.'),
|
||||
'#ajax' => array(
|
||||
'callback' => '_form_test_tableselect_ajax_callback',
|
||||
'wrapper' => 'tableselect-wrapper',
|
||||
),
|
||||
);
|
||||
|
||||
$form['submit'] = array(
|
||||
@@ -697,6 +703,13 @@ function _form_test_vertical_tabs_form($form, &$form_state) {
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax callback that returns the form element.
|
||||
*/
|
||||
function _form_test_tableselect_ajax_callback($form, &$form_state) {
|
||||
return $form['tableselect'];
|
||||
}
|
||||
|
||||
/**
|
||||
* A multistep form for testing the form storage.
|
||||
*
|
||||
|
@@ -207,9 +207,11 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
protected $green = array(0, 255, 0, 0);
|
||||
protected $blue = array(0, 0, 255, 0);
|
||||
protected $yellow = array(255, 255, 0, 0);
|
||||
protected $fuchsia = array(255, 0, 255, 0); // Used as background colors.
|
||||
protected $transparent = array(0, 0, 0, 127);
|
||||
protected $white = array(255, 255, 255, 0);
|
||||
protected $transparent = array(0, 0, 0, 127);
|
||||
// Used as rotate background colors.
|
||||
protected $fuchsia = array(255, 0, 255, 0);
|
||||
protected $rotate_transparent = array(255, 255, 255, 127);
|
||||
|
||||
protected $width = 40;
|
||||
protected $height = 20;
|
||||
@@ -275,6 +277,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
$files = array(
|
||||
'image-test.png',
|
||||
'image-test.gif',
|
||||
'image-test-no-transparency.gif',
|
||||
'image-test.jpg',
|
||||
);
|
||||
|
||||
@@ -334,13 +337,6 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
// Systems using non-bundled GD2 don't have imagerotate. Test if available.
|
||||
if (function_exists('imagerotate')) {
|
||||
$operations += array(
|
||||
'rotate_5' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(5, 0xFF00FF), // Fuchsia background.
|
||||
'width' => 42,
|
||||
'height' => 24,
|
||||
'corners' => array_fill(0, 4, $this->fuchsia),
|
||||
),
|
||||
'rotate_90' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(90, 0xFF00FF), // Fuchsia background.
|
||||
@@ -348,13 +344,6 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
'height' => 40,
|
||||
'corners' => array($this->fuchsia, $this->red, $this->green, $this->blue),
|
||||
),
|
||||
'rotate_transparent_5' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(5),
|
||||
'width' => 42,
|
||||
'height' => 24,
|
||||
'corners' => array_fill(0, 4, $this->transparent),
|
||||
),
|
||||
'rotate_transparent_90' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(90),
|
||||
@@ -363,6 +352,49 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
'corners' => array($this->transparent, $this->red, $this->green, $this->blue),
|
||||
),
|
||||
);
|
||||
// As of PHP version 5.5, GD uses a different algorithm to rotate images
|
||||
// than version 5.4 and below, resulting in different dimensions.
|
||||
// See https://bugs.php.net/bug.php?id=65148.
|
||||
// For the 40x20 test images, the dimensions resulting from rotation will
|
||||
// be 1 pixel smaller in both width and height in PHP 5.5 and above.
|
||||
// @todo: If and when the PHP bug gets solved, add an upper limit
|
||||
// version check.
|
||||
if (version_compare(PHP_VERSION, '5.5', '>=')) {
|
||||
$operations += array(
|
||||
'rotate_5' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(5, 0xFF00FF), // Fuchsia background.
|
||||
'width' => 41,
|
||||
'height' => 23,
|
||||
'corners' => array_fill(0, 4, $this->fuchsia),
|
||||
),
|
||||
'rotate_transparent_5' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(5),
|
||||
'width' => 41,
|
||||
'height' => 23,
|
||||
'corners' => array_fill(0, 4, $this->rotate_transparent),
|
||||
),
|
||||
);
|
||||
}
|
||||
else {
|
||||
$operations += array(
|
||||
'rotate_5' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(5, 0xFF00FF), // Fuchsia background.
|
||||
'width' => 42,
|
||||
'height' => 24,
|
||||
'corners' => array_fill(0, 4, $this->fuchsia),
|
||||
),
|
||||
'rotate_transparent_5' => array(
|
||||
'function' => 'rotate',
|
||||
'arguments' => array(5),
|
||||
'width' => 42,
|
||||
'height' => 24,
|
||||
'corners' => array_fill(0, 4, $this->rotate_transparent),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Systems using non-bundled GD2 don't have imagefilter. Test if available.
|
||||
@@ -430,6 +462,11 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
|
||||
}
|
||||
// Now check each of the corners to ensure color correctness.
|
||||
foreach ($values['corners'] as $key => $corner) {
|
||||
// The test gif that does not have transparency has yellow where the
|
||||
// others have transparent.
|
||||
if ($file === 'image-test-no-transparency.gif' && $corner === $this->transparent) {
|
||||
$corner = $this->yellow;
|
||||
}
|
||||
// Get the location of the corner.
|
||||
switch ($key) {
|
||||
case 0:
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -441,7 +441,7 @@ class DrupalHtmlToTextTestCase extends DrupalWebTestCase {
|
||||
* <CRLF> is 1000 characters."
|
||||
*/
|
||||
function testVeryLongLineWrap() {
|
||||
$input = 'Drupal<br /><p>' . str_repeat('x', 2100) . '</><br />Drupal';
|
||||
$input = 'Drupal<br /><p>' . str_repeat('x', 2100) . '</p><br />Drupal';
|
||||
$output = drupal_html_to_text($input);
|
||||
// This awkward construct comes from includes/mail.inc lines 8-13.
|
||||
$eol = variable_get('mail_line_endings', MAIL_LINE_ENDINGS);
|
||||
@@ -455,7 +455,6 @@ class DrupalHtmlToTextTestCase extends DrupalWebTestCase {
|
||||
$maximum_line_length = max($maximum_line_length, strlen($line . $eol));
|
||||
}
|
||||
$verbose = 'Maximum line length found was ' . $maximum_line_length . ' octets.';
|
||||
// @todo This should assert that $maximum_line_length <= 1000.
|
||||
$this->pass($verbose);
|
||||
$this->assertTrue($maximum_line_length <= 1000, $verbose);
|
||||
}
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -302,3 +302,45 @@ class ModuleUninstallTestCase extends DrupalWebTestCase {
|
||||
$this->assertEqual(0, $count, 'Permissions were all removed.');
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleImplementsAlterTestCase extends DrupalWebTestCase {
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Module implements alter',
|
||||
'description' => 'Tests hook_module_implements_alter().',
|
||||
'group' => 'Module',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests hook_module_implements_alter() adding an implementation.
|
||||
*/
|
||||
function testModuleImplementsAlter() {
|
||||
module_enable(array('module_test'), FALSE);
|
||||
$this->assertTrue(module_exists('module_test'), 'Test module is enabled.');
|
||||
|
||||
// Assert that module_test.module is now included.
|
||||
$this->assertTrue(function_exists('module_test_permission'),
|
||||
'The file module_test.module was successfully included.');
|
||||
|
||||
$modules = module_implements('permission');
|
||||
$this->assertTrue(in_array('module_test', $modules), 'module_test implements hook_permission.');
|
||||
|
||||
$modules = module_implements('module_implements_alter');
|
||||
$this->assertTrue(in_array('module_test', $modules), 'module_test implements hook_module_implements_alter().');
|
||||
|
||||
// Assert that module_test.implementations.inc is not included yet.
|
||||
$this->assertFalse(function_exists('module_test_altered_test_hook'),
|
||||
'The file module_test.implementations.inc is not included yet.');
|
||||
|
||||
// Assert that module_test_module_implements_alter(*, 'altered_test_hook')
|
||||
// has added an implementation
|
||||
$this->assertTrue(in_array('module_test', module_implements('altered_test_hook')),
|
||||
'module_test implements hook_altered_test_hook().');
|
||||
|
||||
// Assert that module_test.implementations.inc was included as part of the process.
|
||||
$this->assertTrue(function_exists('module_test_altered_test_hook'),
|
||||
'The file module_test.implementations.inc was included.');
|
||||
}
|
||||
|
||||
}
|
||||
|
10
modules/simpletest/tests/module_test.implementations.inc
Normal file
10
modules/simpletest/tests/module_test.implementations.inc
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Implements hook_altered_test_hook()
|
||||
*
|
||||
* @see module_test_module_implements_alter()
|
||||
*/
|
||||
function module_test_altered_test_hook() {
|
||||
return __FUNCTION__;
|
||||
}
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -129,3 +129,14 @@ function module_test_modules_uninstalled($modules) {
|
||||
// can check that the modules were uninstalled in the correct sequence.
|
||||
variable_set('test_module_uninstall_order', $modules);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_module_implements_alter()
|
||||
*/
|
||||
function module_test_module_implements_alter(&$implementations, $hook) {
|
||||
if ($hook === 'altered_test_hook') {
|
||||
// Add a hook implementation, that will be found in
|
||||
// module_test.implementations.inc.
|
||||
$implementations['module_test'] = 'implementations';
|
||||
}
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ core = 7.x
|
||||
hidden = TRUE
|
||||
package = Testing
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ core = 7.x
|
||||
hidden = TRUE
|
||||
package = Testing
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -7,8 +7,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -477,6 +477,56 @@ class SessionHttpsTestCase extends DrupalWebTestCase {
|
||||
$this->assertResponse(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that empty session IDs do not cause unrelated sessions to load.
|
||||
*/
|
||||
public function testEmptySessionId() {
|
||||
global $is_https;
|
||||
|
||||
if ($is_https) {
|
||||
$secure_session_name = session_name();
|
||||
}
|
||||
else {
|
||||
$secure_session_name = 'S' . session_name();
|
||||
}
|
||||
|
||||
// Enable mixed mode for HTTP and HTTPS.
|
||||
variable_set('https', TRUE);
|
||||
|
||||
$admin_user = $this->drupalCreateUser(array('access administration pages'));
|
||||
$standard_user = $this->drupalCreateUser(array('access content'));
|
||||
|
||||
// First log in as the admin user on HTTP.
|
||||
// We cannot use $this->drupalLogin() here because we need to use the
|
||||
// special http.php URLs.
|
||||
$edit = array(
|
||||
'name' => $admin_user->name,
|
||||
'pass' => $admin_user->pass_raw
|
||||
);
|
||||
$this->drupalGet('user');
|
||||
$form = $this->xpath('//form[@id="user-login"]');
|
||||
$form[0]['action'] = $this->httpUrl('user');
|
||||
$this->drupalPost(NULL, $edit, t('Log in'));
|
||||
|
||||
$this->curlClose();
|
||||
|
||||
// Now start a session for the standard user on HTTPS.
|
||||
$edit = array(
|
||||
'name' => $standard_user->name,
|
||||
'pass' => $standard_user->pass_raw
|
||||
);
|
||||
$this->drupalGet('user');
|
||||
$form = $this->xpath('//form[@id="user-login"]');
|
||||
$form[0]['action'] = $this->httpsUrl('user');
|
||||
$this->drupalPost(NULL, $edit, t('Log in'));
|
||||
|
||||
// Make the secure session cookie blank.
|
||||
curl_setopt($this->curlHandle, CURLOPT_COOKIE, "$secure_session_name=");
|
||||
$this->drupalGet($this->httpsUrl('user'));
|
||||
$this->assertNoText($admin_user->name, 'User is not logged in as admin');
|
||||
$this->assertNoText($standard_user->name, "The user's own name is not displayed because the invalid session cookie has logged them out.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that there exists a session with two specific session IDs.
|
||||
*
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
hidden = TRUE
|
||||
dependencies[] = _missing_dependency
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
hidden = TRUE
|
||||
dependencies[] = system_incompatible_core_version_test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 5.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -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 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = 1.0
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
13
modules/simpletest/tests/system_project_namespace_test.info
Normal file
13
modules/simpletest/tests/system_project_namespace_test.info
Normal file
@@ -0,0 +1,13 @@
|
||||
name = "System project namespace test"
|
||||
description = "Support module for testing project namespace dependencies."
|
||||
package = Testing
|
||||
version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
dependencies[] = drupal:filter
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1475694174"
|
||||
|
@@ -0,0 +1 @@
|
||||
<?php
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = system_test.module
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
20
modules/simpletest/tests/system_test.install
Normal file
20
modules/simpletest/tests/system_test.install
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Install, update and uninstall functions for the system_test module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_schema().
|
||||
*/
|
||||
function system_test_schema() {
|
||||
// Trigger a search for a module in the filesystem when requested by
|
||||
// system_test_drupal_get_filename_with_schema_rebuild().
|
||||
if (variable_get('system_test_drupal_get_filename_attempt_recursive_rebuild')) {
|
||||
$module_name = variable_get('system_test_drupal_get_filename_test_module_name');
|
||||
drupal_get_filename('module', $module_name);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
@@ -127,6 +127,20 @@ function system_test_menu() {
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
|
||||
$items['system-test/drupal-get-filename'] = array(
|
||||
'title' => 'Test drupal_get_filename()',
|
||||
'page callback' => 'system_test_drupal_get_filename',
|
||||
'access callback' => TRUE,
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
|
||||
$items['system-test/drupal-get-filename-with-schema-rebuild'] = array(
|
||||
'title' => 'Test drupal_get_filename() with a schema rebuild',
|
||||
'page callback' => 'system_test_drupal_get_filename_with_schema_rebuild',
|
||||
'access callback' => TRUE,
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
@@ -296,6 +310,9 @@ function system_test_system_info_alter(&$info, $file, $type) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($file->name == 'system_project_namespace_test') {
|
||||
$info['hidden'] = FALSE;
|
||||
}
|
||||
// Make the system_dependencies_test visible by default.
|
||||
if ($file->name == 'system_dependencies_test') {
|
||||
$info['hidden'] = FALSE;
|
||||
@@ -479,3 +496,76 @@ function system_test_request_destination() {
|
||||
// information.
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Page callback to run drupal_get_filename() on a particular module.
|
||||
*/
|
||||
function system_test_drupal_get_filename() {
|
||||
// Prevent SimpleTest from failing as a result of the expected PHP warnings
|
||||
// this function causes. Any warnings will be recorded in the database logs
|
||||
// for examination by the tests.
|
||||
define('SIMPLETEST_COLLECT_ERRORS', FALSE);
|
||||
|
||||
$module_name = variable_get('system_test_drupal_get_filename_test_module_name');
|
||||
drupal_get_filename('module', $module_name);
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Page callback to run drupal_get_filename() and do a schema rebuild.
|
||||
*/
|
||||
function system_test_drupal_get_filename_with_schema_rebuild() {
|
||||
// Prevent SimpleTest from failing as a result of the expected PHP warnings
|
||||
// this function causes.
|
||||
define('SIMPLETEST_COLLECT_ERRORS', FALSE);
|
||||
|
||||
// Record the original database tables from drupal_get_schema().
|
||||
variable_set('system_test_drupal_get_filename_with_schema_rebuild_original_tables', array_keys(drupal_get_schema(NULL, TRUE)));
|
||||
|
||||
// Trigger system_test_schema() and system_test_watchdog() to perform an
|
||||
// attempted recursive rebuild when drupal_get_schema() is called. See
|
||||
// BootstrapGetFilenameWebTestCase::testRecursiveRebuilds().
|
||||
variable_set('system_test_drupal_get_filename_attempt_recursive_rebuild', TRUE);
|
||||
drupal_get_schema(NULL, TRUE);
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_watchdog().
|
||||
*/
|
||||
function system_test_watchdog($log_entry) {
|
||||
// If an attempted recursive schema rebuild has been triggered by
|
||||
// system_test_drupal_get_filename_with_schema_rebuild(), perform the rebuild
|
||||
// in response to the missing file message triggered by system_test_schema().
|
||||
if (!variable_get('system_test_drupal_get_filename_attempt_recursive_rebuild')) {
|
||||
return;
|
||||
}
|
||||
if ($log_entry['type'] != 'php' || $log_entry['severity'] != WATCHDOG_WARNING) {
|
||||
return;
|
||||
}
|
||||
$module_name = variable_get('system_test_drupal_get_filename_test_module_name');
|
||||
if (!isset($log_entry['variables']['!message']) || strpos($log_entry['variables']['!message'], format_string('The following module is missing from the file system: %name', array('%name' => $module_name))) === FALSE) {
|
||||
return;
|
||||
}
|
||||
variable_set('system_test_drupal_get_filename_with_schema_rebuild_final_tables', array_keys(drupal_get_schema()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_module_implements_alter().
|
||||
*/
|
||||
function system_test_module_implements_alter(&$implementations, $hook) {
|
||||
// For BootstrapGetFilenameWebTestCase::testRecursiveRebuilds() to work
|
||||
// correctly, this module's hook_schema() implementation cannot be either the
|
||||
// first implementation (since that would trigger a potential recursive
|
||||
// rebuild before anything is in the drupal_get_schema() cache) or the last
|
||||
// implementation (since that would trigger a potential recursive rebuild
|
||||
// after the cache is already complete). So put it somewhere in the middle.
|
||||
if ($hook == 'schema') {
|
||||
$group = $implementations['system_test'];
|
||||
unset($implementations['system_test']);
|
||||
$count = count($implementations);
|
||||
$implementations = array_merge(array_slice($implementations, 0, $count / 2, TRUE), array('system_test' => $group), array_slice($implementations, $count / 2, NULL, TRUE));
|
||||
}
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
hidden = TRUE
|
||||
dependencies[] = taxonomy
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -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 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ hidden = TRUE
|
||||
|
||||
settings[subtheme_override] = subtheme value
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -17,8 +17,8 @@ stylesheets[all][] = system.base.css
|
||||
|
||||
settings[theme_test_setting] = default value
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -31,6 +31,19 @@ function update_script_test_requirements($phase) {
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
);
|
||||
break;
|
||||
case REQUIREMENT_INFO:
|
||||
$requirements['update_script_test_stop'] = array(
|
||||
'title' => 'Update script test stop',
|
||||
'value' => 'Error',
|
||||
'description' => 'This is a requirements error provided by the update_script_test module to stop the page redirect for the info.',
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
);
|
||||
$requirements['update_script_test'] = array(
|
||||
'title' => 'Update script test',
|
||||
'description' => 'This is a requirements info provided by the update_script_test module.',
|
||||
'severity' => REQUIREMENT_INFO,
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -19919,7 +19919,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '1',
|
||||
'name' => 'vocabulary 1 (i=0)',
|
||||
'description' => 'description of vocabulary 1 (i=0)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 1 (i=0)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '0',
|
||||
'multiple' => '0',
|
||||
@@ -19932,7 +19932,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '2',
|
||||
'name' => 'vocabulary 2 (i=1)',
|
||||
'description' => 'description of vocabulary 2 (i=1)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 2 (i=1)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '1',
|
||||
'multiple' => '1',
|
||||
@@ -19945,7 +19945,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '3',
|
||||
'name' => 'vocabulary 3 (i=2)',
|
||||
'description' => 'description of vocabulary 3 (i=2)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 3 (i=2)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '2',
|
||||
'multiple' => '0',
|
||||
@@ -19958,7 +19958,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '4',
|
||||
'name' => 'vocabulary 4 (i=3)',
|
||||
'description' => 'description of vocabulary 4 (i=3)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 4 (i=3)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '0',
|
||||
'multiple' => '1',
|
||||
@@ -19971,7 +19971,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '5',
|
||||
'name' => 'vocabulary 5 (i=4)',
|
||||
'description' => 'description of vocabulary 5 (i=4)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 5 (i=4)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '1',
|
||||
'multiple' => '0',
|
||||
@@ -19984,7 +19984,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '6',
|
||||
'name' => 'vocabulary 6 (i=5)',
|
||||
'description' => 'description of vocabulary 6 (i=5)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 6 (i=5)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '2',
|
||||
'multiple' => '1',
|
||||
@@ -19997,7 +19997,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '7',
|
||||
'name' => 'vocabulary 7 (i=6)',
|
||||
'description' => 'description of vocabulary 7 (i=6)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 7 (i=6)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '0',
|
||||
'multiple' => '0',
|
||||
@@ -20010,7 +20010,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '8',
|
||||
'name' => 'vocabulary 8 (i=7)',
|
||||
'description' => 'description of vocabulary 8 (i=7)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 8 (i=7)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '1',
|
||||
'multiple' => '1',
|
||||
@@ -20023,7 +20023,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '9',
|
||||
'name' => 'vocabulary 9 (i=8)',
|
||||
'description' => 'description of vocabulary 9 (i=8)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 9 (i=8)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '2',
|
||||
'multiple' => '0',
|
||||
@@ -20036,7 +20036,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '10',
|
||||
'name' => 'vocabulary 10 (i=9)',
|
||||
'description' => 'description of vocabulary 10 (i=9)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 10 (i=9)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '0',
|
||||
'multiple' => '1',
|
||||
@@ -20049,7 +20049,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '11',
|
||||
'name' => 'vocabulary 11 (i=10)',
|
||||
'description' => 'description of vocabulary 11 (i=10)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 11 (i=10)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '1',
|
||||
'multiple' => '0',
|
||||
@@ -20062,7 +20062,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '12',
|
||||
'name' => 'vocabulary 12 (i=11)',
|
||||
'description' => 'description of vocabulary 12 (i=11)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 12 (i=11)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '2',
|
||||
'multiple' => '1',
|
||||
@@ -20075,7 +20075,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '13',
|
||||
'name' => 'vocabulary 13 (i=12)',
|
||||
'description' => 'description of vocabulary 13 (i=12)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 13 (i=12)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '0',
|
||||
'multiple' => '0',
|
||||
@@ -20088,7 +20088,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '14',
|
||||
'name' => 'vocabulary 14 (i=13)',
|
||||
'description' => 'description of vocabulary 14 (i=13)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 14 (i=13)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '1',
|
||||
'multiple' => '1',
|
||||
@@ -20101,7 +20101,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '15',
|
||||
'name' => 'vocabulary 15 (i=14)',
|
||||
'description' => 'description of vocabulary 15 (i=14)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 15 (i=14)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '2',
|
||||
'multiple' => '0',
|
||||
@@ -20114,7 +20114,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '16',
|
||||
'name' => 'vocabulary 16 (i=15)',
|
||||
'description' => 'description of vocabulary 16 (i=15)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 16 (i=15)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '0',
|
||||
'multiple' => '1',
|
||||
@@ -20127,7 +20127,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '17',
|
||||
'name' => 'vocabulary 17 (i=16)',
|
||||
'description' => 'description of vocabulary 17 (i=16)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 17 (i=16)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '1',
|
||||
'multiple' => '0',
|
||||
@@ -20140,7 +20140,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '18',
|
||||
'name' => 'vocabulary 18 (i=17)',
|
||||
'description' => 'description of vocabulary 18 (i=17)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 18 (i=17)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '2',
|
||||
'multiple' => '1',
|
||||
@@ -20153,7 +20153,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '19',
|
||||
'name' => 'vocabulary 19 (i=18)',
|
||||
'description' => 'description of vocabulary 19 (i=18)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 19 (i=18)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '0',
|
||||
'multiple' => '0',
|
||||
@@ -20166,7 +20166,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '20',
|
||||
'name' => 'vocabulary 20 (i=19)',
|
||||
'description' => 'description of vocabulary 20 (i=19)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 20 (i=19)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '1',
|
||||
'multiple' => '1',
|
||||
@@ -20179,7 +20179,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '21',
|
||||
'name' => 'vocabulary 21 (i=20)',
|
||||
'description' => 'description of vocabulary 21 (i=20)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 21 (i=20)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '2',
|
||||
'multiple' => '0',
|
||||
@@ -20192,7 +20192,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '22',
|
||||
'name' => 'vocabulary 22 (i=21)',
|
||||
'description' => 'description of vocabulary 22 (i=21)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 22 (i=21)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '0',
|
||||
'multiple' => '1',
|
||||
@@ -20205,7 +20205,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '23',
|
||||
'name' => 'vocabulary 23 (i=22)',
|
||||
'description' => 'description of vocabulary 23 (i=22)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 23 (i=22)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '1',
|
||||
'multiple' => '0',
|
||||
@@ -20218,7 +20218,7 @@ db_insert('vocabulary')->fields(array(
|
||||
'vid' => '24',
|
||||
'name' => 'vocabulary 24 (i=23)',
|
||||
'description' => 'description of vocabulary 24 (i=23)',
|
||||
'help' => '',
|
||||
'help' => 'help for vocabulary 24 (i=23)',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '2',
|
||||
'multiple' => '1',
|
||||
|
@@ -127,6 +127,38 @@ db_insert('files')->fields(array(
|
||||
'status' => '1',
|
||||
'timestamp' => '1285708958',
|
||||
))
|
||||
// On some Drupal 6 sites, more than one file can have the same filepath. See
|
||||
// https://www.drupal.org/node/1260938.
|
||||
->values(array(
|
||||
'fid' => '12',
|
||||
'uid' => '1',
|
||||
'filename' => 'duplicate-name.png',
|
||||
'filepath' => 'sites/default/files/duplicate-name.png',
|
||||
'filemime' => 'image/png',
|
||||
'filesize' => '314',
|
||||
'status' => '1',
|
||||
'timestamp' => '1285708958',
|
||||
))
|
||||
->values(array(
|
||||
'fid' => '13',
|
||||
'uid' => '1',
|
||||
'filename' => 'duplicate-name.png',
|
||||
'filepath' => 'sites/default/files/duplicate-name.png',
|
||||
'filemime' => 'image/png',
|
||||
'filesize' => '315',
|
||||
'status' => '1',
|
||||
'timestamp' => '1285708958',
|
||||
))
|
||||
->values(array(
|
||||
'fid' => '14',
|
||||
'uid' => '1',
|
||||
'filename' => 'duplicate-name.png',
|
||||
'filepath' => 'sites/default/files/duplicate-name.png',
|
||||
'filemime' => 'image/png',
|
||||
'filesize' => '316',
|
||||
'status' => '1',
|
||||
'timestamp' => '1285708958',
|
||||
))
|
||||
->execute();
|
||||
|
||||
db_insert('node')->fields(array(
|
||||
@@ -196,6 +228,23 @@ db_insert('node')->fields(array(
|
||||
'sticky' => '0',
|
||||
'tnid' => '0',
|
||||
'translate' => '0',
|
||||
))
|
||||
->values(array(
|
||||
'nid' => '41',
|
||||
'vid' => '55',
|
||||
'type' => 'page',
|
||||
'language' => '',
|
||||
'title' => 'node title 41 revision 55',
|
||||
'uid' => '1',
|
||||
'status' => '1',
|
||||
'created' => '1285709012',
|
||||
'changed' => '1285709012',
|
||||
'comment' => '0',
|
||||
'promote' => '0',
|
||||
'moderate' => '0',
|
||||
'sticky' => '0',
|
||||
'tnid' => '0',
|
||||
'translate' => '0',
|
||||
))
|
||||
->execute();
|
||||
|
||||
@@ -253,6 +302,28 @@ db_insert('node_revisions')->fields(array(
|
||||
'log' => '',
|
||||
'timestamp' => '1285709012',
|
||||
'format' => '1',
|
||||
))
|
||||
->values(array(
|
||||
'nid' => '41',
|
||||
'vid' => '54',
|
||||
'uid' => '1',
|
||||
'title' => 'node title 41 revision 54',
|
||||
'body' => "Attachments:\r\nduplicate-name.png",
|
||||
'teaser' => "Attachments:\r\nduplicate-name.png",
|
||||
'log' => '',
|
||||
'timestamp' => '1285709012',
|
||||
'format' => '1',
|
||||
))
|
||||
->values(array(
|
||||
'nid' => '41',
|
||||
'vid' => '55',
|
||||
'uid' => '1',
|
||||
'title' => 'node title 41 revision 55',
|
||||
'body' => "Attachments:\r\nduplicate-name.png\r\nduplicate-name.png",
|
||||
'teaser' => "Attachments:\r\nduplicate-name.png\r\nduplicate-name.png",
|
||||
'log' => '',
|
||||
'timestamp' => '1285709012',
|
||||
'format' => '1',
|
||||
))
|
||||
->execute();
|
||||
|
||||
@@ -415,6 +486,30 @@ db_insert('upload')->fields(array(
|
||||
'list' => '1',
|
||||
'weight' => '0',
|
||||
))
|
||||
->values(array(
|
||||
'fid' => '12',
|
||||
'nid' => '41',
|
||||
'vid' => '54',
|
||||
'description' => 'duplicate-name.png',
|
||||
'list' => '1',
|
||||
'weight' => '0',
|
||||
))
|
||||
->values(array(
|
||||
'fid' => '13',
|
||||
'nid' => '41',
|
||||
'vid' => '55',
|
||||
'description' => 'first description',
|
||||
'list' => '0',
|
||||
'weight' => '0',
|
||||
))
|
||||
->values(array(
|
||||
'fid' => '14',
|
||||
'nid' => '41',
|
||||
'vid' => '55',
|
||||
'description' => 'second description',
|
||||
'list' => '1',
|
||||
'weight' => '0',
|
||||
))
|
||||
->execute();
|
||||
|
||||
// Add series of entries for invalid node vids to the {upload} table.
|
||||
@@ -431,7 +526,7 @@ for ($i = 30; $i < 250; $i += 2) {
|
||||
->values(array(
|
||||
'fid' => $i,
|
||||
'nid' => '40',
|
||||
'vid' => 24 + $i,
|
||||
'vid' => 26 + $i,
|
||||
'description' => 'crazy-basename.png',
|
||||
'list' => '1',
|
||||
'weight' => '0',
|
||||
@@ -440,7 +535,7 @@ for ($i = 30; $i < 250; $i += 2) {
|
||||
->values(array(
|
||||
'fid' => 2,
|
||||
'nid' => '40',
|
||||
'vid' => 24 + $i + 1,
|
||||
'vid' => 26 + $i + 1,
|
||||
'description' => 'crazy-basename.png',
|
||||
'list' => '1',
|
||||
'weight' => '0',
|
||||
|
@@ -74,9 +74,10 @@ class UpgradePathTaxonomyTestCase extends UpgradePathTestCase {
|
||||
$this->assertEqual($voc_keys, $inst_keys, 'Node type page has instances for every vocabulary.');
|
||||
|
||||
// Ensure instance variables are getting through.
|
||||
foreach ($instances as $instance) {
|
||||
$this->assertTrue(isset($instance['required']), 'The required setting was preserved during the upgrade path.');
|
||||
$this->assertTrue($instance['description'], 'The description was preserved during the upgrade path');
|
||||
foreach (array_unique($instances) as $instance) {
|
||||
$field_instance = field_info_instance('node', $instance, 'page');
|
||||
$this->assertTrue(isset($field_instance['required']), 'The required setting was preserved during the upgrade path.');
|
||||
$this->assertTrue($field_instance['description'], 'The description was preserved during the upgrade path');
|
||||
}
|
||||
|
||||
// Node type 'story' was not explicitly in $vocabulary->nodes but
|
||||
|
@@ -64,12 +64,35 @@ class UploadUpgradePathTestCase extends UpgradePathTestCase {
|
||||
}
|
||||
$this->assertIdentical($filenames, $recorded_filenames, 'The uploaded files are present in the same order after the upgrade.');
|
||||
}
|
||||
|
||||
// Test for the file with repeating basename to only have the streaming
|
||||
// path replaced.
|
||||
$node = node_load(40, 53);
|
||||
$repeated_basename_file = $node->upload[LANGUAGE_NONE][4];
|
||||
$this->assertEqual($repeated_basename_file['uri'], 'private://drupal-6/file/directory/path/crazy-basename.png', "The file with the repeated basename path only had the stream portion replaced");
|
||||
|
||||
// Ensure that filepaths are deduplicated.
|
||||
$node0 = node_load(41, 54);
|
||||
$node1 = node_load(41, 55);
|
||||
// Ensure that both revisions point to the same file ID.
|
||||
$items0 = field_get_items('node', $node0, 'upload');
|
||||
$this->assertEqual(count($items0), 1);
|
||||
$items1 = field_get_items('node', $node1, 'upload');
|
||||
$this->assertEqual(count($items1), 2);
|
||||
$this->assertEqual($items0[0]['fid'], $items1[0]['fid']);
|
||||
$this->assertEqual($items0[0]['fid'], $items1[1]['fid']);
|
||||
// The revision with more than one reference to the same file should retain
|
||||
// the original settings for each reference.
|
||||
$this->assertEqual($items1[0]['description'], 'first description');
|
||||
$this->assertEqual($items1[0]['display'], 0);
|
||||
$this->assertEqual($items1[1]['description'], 'second description');
|
||||
$this->assertEqual($items1[1]['display'], 1);
|
||||
// Ensure that the latest version of the files are used.
|
||||
$this->assertEqual($items1[0]['filesize'], 316);
|
||||
$this->assertEqual($items1[1]['filesize'], 316);
|
||||
// No duplicate files should remain on the Drupal 7 site.
|
||||
$this->assertEqual(0, db_query("SELECT COUNT(*) FROM {file_managed} GROUP BY uri HAVING COUNT(fid) > 1")->fetchField());
|
||||
|
||||
// Make sure the file settings were properly migrated.
|
||||
$d6_file_directory_temp = '/drupal-6/file/directory/temp';
|
||||
$d6_file_directory_path = '/drupal-6/file/directory/path';
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -246,4 +246,38 @@ class XMLRPCMessagesTestCase extends DrupalWebTestCase {
|
||||
$this->assertEqual($removed, 'system.methodSignature', 'Hiding builting system.methodSignature with hook_xmlrpc_alter works');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test limits on system.multicall that can prevent brute-force attacks.
|
||||
*/
|
||||
function testMulticallLimit() {
|
||||
$url = url(NULL, array('absolute' => TRUE)) . 'xmlrpc.php';
|
||||
$multicall_args = array();
|
||||
$num_method_calls = 10;
|
||||
for ($i = 0; $i < $num_method_calls; $i++) {
|
||||
$struct = array('i' => $i);
|
||||
$multicall_args[] = array('methodName' => 'validator1.echoStructTest', 'params' => array($struct));
|
||||
}
|
||||
// Test limits of 1, 5, 9, 13.
|
||||
for ($limit = 1; $limit < $num_method_calls + 4; $limit += 4) {
|
||||
variable_set('xmlrpc_multicall_duplicate_method_limit', $limit);
|
||||
$results = xmlrpc($url, array('system.multicall' => array($multicall_args)));
|
||||
$this->assertEqual($num_method_calls, count($results));
|
||||
for ($i = 0; $i < min($limit, $num_method_calls); $i++) {
|
||||
$x = array_shift($results);
|
||||
$this->assertTrue(empty($x->is_error), "Result $i is not an error");
|
||||
$this->assertEqual($multicall_args[$i]['params'][0], $x);
|
||||
}
|
||||
for (; $i < $num_method_calls; $i++) {
|
||||
$x = array_shift($results);
|
||||
$this->assertFalse(empty($x->is_error), "Result $i is an error");
|
||||
$this->assertEqual(-156579, $x->code);
|
||||
}
|
||||
}
|
||||
variable_set('xmlrpc_multicall_duplicate_method_limit', -1);
|
||||
$results = xmlrpc($url, array('system.multicall' => array($multicall_args)));
|
||||
$this->assertEqual($num_method_calls, count($results));
|
||||
foreach ($results as $i => $x) {
|
||||
$this->assertTrue(empty($x->is_error), "Result $i is not an error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-04-02
|
||||
version = "7.36"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1427943826"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
Reference in New Issue
Block a user