updated drupal core to 7.51
This commit is contained in:
@@ -7,8 +7,8 @@ files[] = aggregator.test
|
||||
configure = admin/config/services/aggregator/settings
|
||||
stylesheets[all][] = aggregator.css
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -72,7 +72,7 @@ function aggregator_aggregator_remove($feed) {
|
||||
*/
|
||||
function aggregator_form_aggregator_admin_form_alter(&$form, $form_state) {
|
||||
if (in_array('aggregator', variable_get('aggregator_processors', array('aggregator')))) {
|
||||
$info = module_invoke('aggregator', 'aggregator_process', 'info');
|
||||
$info = module_invoke('aggregator', 'aggregator_process_info');
|
||||
$items = drupal_map_assoc(array(3, 5, 10, 15, 20, 25), '_aggregator_items');
|
||||
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
|
||||
$period[AGGREGATOR_CLEAR_NEVER] = t('Never');
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = block.test
|
||||
configure = admin/structure/block
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -285,8 +285,7 @@ function block_page_build(&$page) {
|
||||
// Append region description if we are rendering the regions demo page.
|
||||
$item = menu_get_item();
|
||||
if ($item['path'] == 'admin/structure/block/demo/' . $theme) {
|
||||
$visible_regions = array_keys(system_region_list($theme, REGIONS_VISIBLE));
|
||||
foreach ($visible_regions as $region) {
|
||||
foreach (system_region_list($theme, REGIONS_VISIBLE, FALSE) as $region) {
|
||||
$description = '<div class="block-region">' . $all_regions[$region] . '</div>';
|
||||
$page[$region]['block_description'] = array(
|
||||
'#markup' => $description,
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -13,8 +13,8 @@ regions[footer] = Footer
|
||||
regions[highlighted] = Highlighted
|
||||
regions[help] = Help
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = blog.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -152,7 +152,7 @@ function blog_menu_local_tasks_alter(&$data, $router_item, $root_path) {
|
||||
}
|
||||
}
|
||||
// Provide a helper action link to the author on the 'blog/%' page.
|
||||
elseif ($root_path == 'blog/%' && $router_item['page_arguments'][0]->uid == $user->uid) {
|
||||
elseif ($root_path == 'blog/%' && isset($router_item['page_arguments'][0]->uid) && $router_item['page_arguments'][0]->uid == $user->uid) {
|
||||
$data['actions']['output']['blog'] = array(
|
||||
'#theme' => 'menu_local_action',
|
||||
);
|
||||
|
@@ -7,8 +7,8 @@ files[] = book.test
|
||||
configure = admin/content/book/settings
|
||||
stylesheets[all][] = book.css
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = color.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -9,8 +9,8 @@ files[] = comment.test
|
||||
configure = admin/content/comment
|
||||
stylesheets[all][] = comment.css
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -13,7 +13,7 @@ class CommentHelperCase extends DrupalWebTestCase {
|
||||
function setUp() {
|
||||
parent::setUp('comment', 'search');
|
||||
// Create users and test node.
|
||||
$this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer comments', 'administer blocks', 'administer actions'));
|
||||
$this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer comments', 'administer blocks', 'administer actions', 'administer fields'));
|
||||
$this->web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content', 'edit own comments'));
|
||||
$this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid));
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = contact.test
|
||||
configure = admin/structure/contact
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = contextual.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -7,8 +7,8 @@ files[] = dashboard.test
|
||||
dependencies[] = block
|
||||
configure = admin/dashboard/customize
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -294,11 +294,18 @@ function theme_dblog_message($variables) {
|
||||
else {
|
||||
$output = t($event->message, unserialize($event->variables));
|
||||
}
|
||||
// If the output is expected to be a link, strip all the tags and
|
||||
// special characters by using filter_xss() without any allowed tags.
|
||||
// If not, use filter_xss_admin() to allow some tags.
|
||||
if ($variables['link'] && isset($event->wid)) {
|
||||
// Truncate message to 56 chars.
|
||||
// Truncate message to 56 chars after stripping all the tags.
|
||||
$output = truncate_utf8(filter_xss($output, array()), 56, TRUE, TRUE);
|
||||
$output = l($output, 'admin/reports/event/' . $event->wid, array('html' => TRUE));
|
||||
}
|
||||
else {
|
||||
// Prevent XSS in log detail pages.
|
||||
$output = filter_xss_admin($output);
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = dblog.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -154,6 +154,15 @@ function dblog_update_7002() {
|
||||
db_add_index('watchdog', 'severity', array('severity'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Account for possible legacy systems where dblog was not installed.
|
||||
*/
|
||||
function dblog_update_7003() {
|
||||
if (!db_table_exists('watchdog')) {
|
||||
db_create_table('watchdog', drupal_get_schema_unprocessed('dblog', 'watchdog'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-7.x-extra".
|
||||
*/
|
||||
|
@@ -147,20 +147,27 @@ function dblog_watchdog(array $log_entry) {
|
||||
if (!function_exists('drupal_substr')) {
|
||||
require_once DRUPAL_ROOT . '/includes/unicode.inc';
|
||||
}
|
||||
Database::getConnection('default', 'default')->insert('watchdog')
|
||||
->fields(array(
|
||||
'uid' => $log_entry['uid'],
|
||||
'type' => drupal_substr($log_entry['type'], 0, 64),
|
||||
'message' => $log_entry['message'],
|
||||
'variables' => serialize($log_entry['variables']),
|
||||
'severity' => $log_entry['severity'],
|
||||
'link' => drupal_substr($log_entry['link'], 0, 255),
|
||||
'location' => $log_entry['request_uri'],
|
||||
'referer' => $log_entry['referer'],
|
||||
'hostname' => drupal_substr($log_entry['ip'], 0, 128),
|
||||
'timestamp' => $log_entry['timestamp'],
|
||||
))
|
||||
->execute();
|
||||
try {
|
||||
Database::getConnection('default', 'default')->insert('watchdog')
|
||||
->fields(array(
|
||||
'uid' => $log_entry['uid'],
|
||||
'type' => drupal_substr($log_entry['type'], 0, 64),
|
||||
'message' => $log_entry['message'],
|
||||
'variables' => serialize($log_entry['variables']),
|
||||
'severity' => $log_entry['severity'],
|
||||
'link' => drupal_substr($log_entry['link'], 0, 255),
|
||||
'location' => $log_entry['request_uri'],
|
||||
'referer' => $log_entry['referer'],
|
||||
'hostname' => drupal_substr($log_entry['ip'], 0, 128),
|
||||
'timestamp' => $log_entry['timestamp'],
|
||||
))
|
||||
->execute();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
// Exception is ignored so that watchdog does not break pages during the
|
||||
// installation process or is not able to create the watchdog table during
|
||||
// installation.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -119,7 +119,9 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
private function generateLogEntries($count, $type = 'custom', $severity = WATCHDOG_NOTICE) {
|
||||
global $base_root;
|
||||
|
||||
// Make it just a little bit harder to pass the link part of the test.
|
||||
// This long URL makes it just a little bit harder to pass the link part of
|
||||
// the test with a mix of English words and a repeating series of random
|
||||
// percent-encoded Chinese characters.
|
||||
$link = urldecode('/content/xo%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A-lake-isabelle');
|
||||
|
||||
// Prepare the fields to be logged
|
||||
@@ -518,6 +520,33 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
$this->assertText(t('Database log cleared.'), 'Confirmation message found');
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that exceptions are caught in dblog_watchdog().
|
||||
*/
|
||||
protected function testDBLogException() {
|
||||
$log = array(
|
||||
'type' => 'custom',
|
||||
'message' => 'Log entry added to test watchdog handling of Exceptions.',
|
||||
'variables' => array(),
|
||||
'severity' => WATCHDOG_NOTICE,
|
||||
'link' => NULL,
|
||||
'user' => $this->big_user,
|
||||
'uid' => isset($this->big_user->uid) ? $this->big_user->uid : 0,
|
||||
'request_uri' => request_uri(),
|
||||
'referer' => $_SERVER['HTTP_REFERER'],
|
||||
'ip' => ip_address(),
|
||||
'timestamp' => REQUEST_TIME,
|
||||
);
|
||||
|
||||
// Remove watchdog table temporarily to simulate it missing during
|
||||
// installation.
|
||||
db_query("DROP TABLE {watchdog}");
|
||||
|
||||
// Add a watchdog entry.
|
||||
// This should not throw an Exception, but fail silently.
|
||||
dblog_watchdog($log);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the database log event information from the browser page.
|
||||
*
|
||||
@@ -636,4 +665,32 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||
// Document Object Model (DOM).
|
||||
$this->assertLink(html_entity_decode($message_text), 0, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure HTML tags are filtered out in the log detail page.
|
||||
*/
|
||||
public function testLogMessageSanitized() {
|
||||
$this->drupalLogin($this->big_user);
|
||||
|
||||
// Make sure dangerous HTML tags are filtered out in log detail page.
|
||||
$log = array(
|
||||
'uid' => 0,
|
||||
'type' => 'custom',
|
||||
'message' => "<script>alert('foo');</script> <strong>Lorem ipsum</strong>",
|
||||
'variables' => NULL,
|
||||
'severity' => WATCHDOG_NOTICE,
|
||||
'link' => 'foo/bar',
|
||||
'request_uri' => 'http://example.com?dblog=1',
|
||||
'referer' => 'http://example.org?dblog=2',
|
||||
'ip' => '0.0.1.0',
|
||||
'timestamp' => REQUEST_TIME,
|
||||
);
|
||||
dblog_watchdog($log);
|
||||
|
||||
$wid = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
|
||||
$this->drupalGet('admin/reports/event/' . $wid);
|
||||
$this->assertResponse(200);
|
||||
$this->assertNoRaw("<script>alert('foo');</script>");
|
||||
$this->assertRaw("alert('foo'); <strong>Lorem ipsum</strong>");
|
||||
}
|
||||
}
|
||||
|
@@ -189,7 +189,7 @@ function field_create_field($field) {
|
||||
}
|
||||
|
||||
// Clear caches
|
||||
field_cache_clear(TRUE);
|
||||
field_cache_clear();
|
||||
|
||||
// Invoke external hooks after the cache is cleared for API consistency.
|
||||
module_invoke_all('field_create_field', $field);
|
||||
@@ -288,7 +288,7 @@ function field_update_field($field) {
|
||||
drupal_write_record('field_config', $field, $primary_key);
|
||||
|
||||
// Clear caches
|
||||
field_cache_clear(TRUE);
|
||||
field_cache_clear();
|
||||
|
||||
// Invoke external hooks after the cache is cleared for API consistency.
|
||||
module_invoke_all('field_update_field', $field, $prior_field, $has_data);
|
||||
@@ -430,7 +430,7 @@ function field_delete_field($field_name) {
|
||||
->execute();
|
||||
|
||||
// Clear the cache.
|
||||
field_cache_clear(TRUE);
|
||||
field_cache_clear();
|
||||
|
||||
module_invoke_all('field_delete_field', $field);
|
||||
}
|
||||
|
@@ -11,8 +11,8 @@ dependencies[] = field_sql_storage
|
||||
required = TRUE
|
||||
stylesheets[all][] = theme/field.css
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -467,6 +467,27 @@ function field_update_7003() {
|
||||
// Empty update to force a rebuild of the registry.
|
||||
}
|
||||
|
||||
/**
|
||||
* Grant the new "administer fields" permission to trusted users.
|
||||
*/
|
||||
function field_update_7004() {
|
||||
// Assign the permission to anyone that already has a trusted core permission
|
||||
// that would have previously let them administer fields on an entity type.
|
||||
$rids = array();
|
||||
$permissions = array(
|
||||
'administer site configuration',
|
||||
'administer content types',
|
||||
'administer users',
|
||||
);
|
||||
foreach ($permissions as $permission) {
|
||||
$rids = array_merge($rids, array_keys(user_roles(FALSE, $permission)));
|
||||
}
|
||||
$rids = array_unique($rids);
|
||||
foreach ($rids as $rid) {
|
||||
_update_7000_user_role_grant_permissions($rid, array('administer fields'), 'field');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-7.x-extra".
|
||||
*/
|
||||
|
@@ -316,6 +316,21 @@ function field_help($path, $arg) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_permission().
|
||||
*/
|
||||
function field_permission() {
|
||||
return array(
|
||||
'administer fields' => array(
|
||||
'title' => t('Administer fields'),
|
||||
'description' => t('Additional permissions are required based on what the fields are attached to (for example, <a href="@url">administer content types</a> to manage fields attached to content).', array(
|
||||
'@url' => '#module-node',
|
||||
)),
|
||||
'restrict access' => TRUE,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_theme().
|
||||
*/
|
||||
|
@@ -7,8 +7,8 @@ dependencies[] = field
|
||||
files[] = field_sql_storage.test
|
||||
required = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -7,8 +7,8 @@ dependencies[] = field
|
||||
dependencies[] = options
|
||||
files[] = tests/list.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -212,7 +212,7 @@ class ListFieldUITestCase extends FieldTestCase {
|
||||
parent::setUp('field_test', 'field_ui');
|
||||
|
||||
// Create test user.
|
||||
$admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer taxonomy'));
|
||||
$admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer taxonomy', 'administer fields'));
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
// Create content type, with underscores.
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = number.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -222,6 +222,8 @@ function number_field_formatter_settings_form($field, $instance, $view_mode, $fo
|
||||
$display = $instance['display'][$view_mode];
|
||||
$settings = $display['settings'];
|
||||
|
||||
$element = array();
|
||||
|
||||
if ($display['type'] == 'number_decimal' || $display['type'] == 'number_integer') {
|
||||
$options = array(
|
||||
'' => t('<none>'),
|
||||
|
@@ -23,7 +23,7 @@ class NumberFieldTestCase extends DrupalWebTestCase {
|
||||
|
||||
function setUp() {
|
||||
parent::setUp('field_test');
|
||||
$this->web_user = $this->drupalCreateUser(array('access field_test content', 'administer field_test content', 'administer content types'));
|
||||
$this->web_user = $this->drupalCreateUser(array('access field_test content', 'administer field_test content', 'administer content types', 'administer fields'));
|
||||
$this->drupalLogin($this->web_user);
|
||||
}
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = options.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -54,7 +54,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
$this->bool = field_create_field($this->bool);
|
||||
|
||||
// Create a web user.
|
||||
$this->web_user = $this->drupalCreateUser(array('access field_test content', 'administer field_test content'));
|
||||
$this->web_user = $this->drupalCreateUser(array('access field_test content', 'administer field_test content', 'administer fields'));
|
||||
$this->drupalLogin($this->web_user);
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
|
||||
$this->assertNoFieldChecked("edit-bool-$langcode");
|
||||
|
||||
// Create admin user.
|
||||
$admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer taxonomy'));
|
||||
$admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer taxonomy', 'administer fields'));
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
// Create a test field instance.
|
||||
|
@@ -7,8 +7,8 @@ dependencies[] = field
|
||||
files[] = text.test
|
||||
required = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -424,6 +424,7 @@ class TextTranslationTestCase extends DrupalWebTestCase {
|
||||
'administer content types',
|
||||
'access administration pages',
|
||||
'bypass node access',
|
||||
'administer fields',
|
||||
filter_permission_name($full_html_format),
|
||||
));
|
||||
$this->translator = $this->drupalCreateUser(array('create article content', 'edit own article content', 'translate content'));
|
||||
|
@@ -6,8 +6,8 @@ files[] = field_test.entity.inc
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = field_ui.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -106,9 +106,19 @@ function field_ui_menu() {
|
||||
$access = array_intersect_key($bundle_info['admin'], drupal_map_assoc(array('access callback', 'access arguments')));
|
||||
$access += array(
|
||||
'access callback' => 'user_access',
|
||||
'access arguments' => array('administer site configuration'),
|
||||
'access arguments' => array('administer fields'),
|
||||
);
|
||||
|
||||
// Add the "administer fields" permission on top of the access
|
||||
// restriction because the field UI should only be accessible to
|
||||
// trusted users.
|
||||
if ($access['access callback'] != 'user_access' || $access['access arguments'] != array('administer fields')) {
|
||||
$access = array(
|
||||
'access callback' => 'field_ui_admin_access',
|
||||
'access arguments' => array($access['access callback'], $access['access arguments']),
|
||||
);
|
||||
}
|
||||
|
||||
$items["$path/fields"] = array(
|
||||
'title' => 'Manage fields',
|
||||
'page callback' => 'drupal_get_form',
|
||||
@@ -392,3 +402,13 @@ function field_ui_form_node_type_form_submit($form, &$form_state) {
|
||||
$form_state['redirect'] = _field_ui_bundle_admin_path('node', $form_state['values']['type']) .'/fields';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Access callback to determine if a user is allowed to use the field UI.
|
||||
*
|
||||
* Only grant access if the user has both the "administer fields" permission and
|
||||
* is granted access by the entity specific restrictions.
|
||||
*/
|
||||
function field_ui_admin_access($access_callback, $access_arguments) {
|
||||
return user_access('administer fields') && call_user_func_array($access_callback, $access_arguments);
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ class FieldUITestCase extends DrupalWebTestCase {
|
||||
parent::setUp($modules);
|
||||
|
||||
// Create test user.
|
||||
$admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer taxonomy'));
|
||||
$admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer taxonomy', 'administer fields'));
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
// Create content type, with underscores.
|
||||
@@ -695,7 +695,7 @@ class FieldUIAlterTestCase extends DrupalWebTestCase {
|
||||
parent::setUp(array('field_test'));
|
||||
|
||||
// Create test user.
|
||||
$admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer users'));
|
||||
$admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer users', 'administer fields'));
|
||||
$this->drupalLogin($admin_user);
|
||||
}
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = tests/file.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -457,6 +457,17 @@ function file_managed_file_process($element, &$form_state, $form) {
|
||||
'#markup' => theme('file_link', array('file' => $element['#file'])) . ' ',
|
||||
'#weight' => -10,
|
||||
);
|
||||
// Anonymous users who have uploaded a temporary file need a
|
||||
// non-session-based token added so file_managed_file_value() can check
|
||||
// that they have permission to use this file on subsequent submissions of
|
||||
// the same form (for example, after an Ajax upload or form validation
|
||||
// error).
|
||||
if (!$GLOBALS['user']->uid && $element['#file']->status != FILE_STATUS_PERMANENT) {
|
||||
$element['fid_token'] = array(
|
||||
'#type' => 'hidden',
|
||||
'#value' => drupal_hmac_base64('file-' . $fid, drupal_get_private_key() . drupal_get_hash_salt()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the extension list to the page as JavaScript settings.
|
||||
@@ -533,13 +544,24 @@ function file_managed_file_value(&$element, $input = FALSE, $form_state = NULL)
|
||||
$force_default = TRUE;
|
||||
}
|
||||
// Temporary files that belong to other users should never be allowed.
|
||||
// Since file ownership can't be determined for anonymous users, they
|
||||
// are not allowed to reuse temporary files at all.
|
||||
elseif ($file->status != FILE_STATUS_PERMANENT && (!$GLOBALS['user']->uid || $file->uid != $GLOBALS['user']->uid)) {
|
||||
$force_default = TRUE;
|
||||
elseif ($file->status != FILE_STATUS_PERMANENT) {
|
||||
if ($GLOBALS['user']->uid && $file->uid != $GLOBALS['user']->uid) {
|
||||
$force_default = TRUE;
|
||||
}
|
||||
// Since file ownership can't be determined for anonymous users, they
|
||||
// are not allowed to reuse temporary files at all. But they do need
|
||||
// to be able to reuse their own files from earlier submissions of
|
||||
// the same form, so to allow that, check for the token added by
|
||||
// file_managed_file_process().
|
||||
elseif (!$GLOBALS['user']->uid) {
|
||||
$token = drupal_array_get_nested_value($form_state['input'], array_merge($element['#parents'], array('fid_token')));
|
||||
if ($token !== drupal_hmac_base64('file-' . $file->fid, drupal_get_private_key() . drupal_get_hash_salt())) {
|
||||
$force_default = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If all checks pass, allow the file to be changed.
|
||||
else {
|
||||
if (!$force_default) {
|
||||
$fid = $file->fid;
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ class FileFieldTestCase extends DrupalWebTestCase {
|
||||
$modules[] = 'file';
|
||||
$modules[] = 'file_module_test';
|
||||
parent::setUp($modules);
|
||||
$this->admin_user = $this->drupalCreateUser(array('access content', 'access administration pages', 'administer site configuration', 'administer users', 'administer permissions', 'administer content types', 'administer nodes', 'bypass node access'));
|
||||
$this->admin_user = $this->drupalCreateUser(array('access content', 'access administration pages', 'administer site configuration', 'administer users', 'administer permissions', 'administer content types', 'administer nodes', 'bypass node access', 'administer fields'));
|
||||
$this->drupalLogin($this->admin_user);
|
||||
}
|
||||
|
||||
@@ -1503,3 +1503,178 @@ class FilePrivateTestCase extends FileFieldTestCase {
|
||||
$this->assertResponse(403, 'Confirmed that access is denied for the file without view field access permission after attempting to attach it to a new node.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm that file field submissions work correctly for anonymous visitors.
|
||||
*/
|
||||
class FileFieldAnonymousSubmission extends FileFieldTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'File form anonymous submission',
|
||||
'description' => 'Test anonymous form submission.',
|
||||
'group' => 'File',
|
||||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Allow node submissions by anonymous users.
|
||||
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array(
|
||||
'create article content',
|
||||
'access content',
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the basic node submission for an anonymous visitor.
|
||||
*/
|
||||
function testAnonymousNode() {
|
||||
$bundle_label = 'Article';
|
||||
$node_title = 'Test page';
|
||||
|
||||
// Load the node form.
|
||||
$this->drupalGet('node/add/article');
|
||||
$this->assertResponse(200, 'Loaded the article node form.');
|
||||
$this->assertText(strip_tags(t('Create @name', array('@name' => $bundle_label))));
|
||||
|
||||
$edit = array(
|
||||
'title' => $node_title,
|
||||
'body[und][0][value]' => 'Test article',
|
||||
'body[und][0][format]' => 'filtered_html',
|
||||
);
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
$this->assertResponse(200);
|
||||
$t_args = array('@type' => $bundle_label, '%title' => $node_title);
|
||||
$this->assertText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
|
||||
$matches = array();
|
||||
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
|
||||
$nid = end($matches);
|
||||
$this->assertNotEqual($nid, 0, 'The node ID was extracted from the URL.');
|
||||
$node = node_load($nid);
|
||||
$this->assertNotEqual($node, NULL, 'The node was loaded successfully.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests file submission for an anonymous visitor.
|
||||
*/
|
||||
function testAnonymousNodeWithFile() {
|
||||
$bundle_label = 'Article';
|
||||
$node_title = 'Test page';
|
||||
|
||||
// Load the node form.
|
||||
$this->drupalGet('node/add/article');
|
||||
$this->assertResponse(200, 'Loaded the article node form.');
|
||||
$this->assertText(strip_tags(t('Create @name', array('@name' => $bundle_label))));
|
||||
|
||||
// Generate an image file.
|
||||
$image = $this->getTestImage();
|
||||
|
||||
// Submit the form.
|
||||
$edit = array(
|
||||
'title' => $node_title,
|
||||
'body[und][0][value]' => 'Test article',
|
||||
'body[und][0][format]' => 'filtered_html',
|
||||
'files[field_image_und_0]' => drupal_realpath($image->uri),
|
||||
);
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
$this->assertResponse(200);
|
||||
$t_args = array('@type' => $bundle_label, '%title' => $node_title);
|
||||
$this->assertText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
|
||||
$matches = array();
|
||||
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
|
||||
$nid = end($matches);
|
||||
$this->assertNotEqual($nid, 0, 'The node ID was extracted from the URL.');
|
||||
$node = node_load($nid);
|
||||
$this->assertNotEqual($node, NULL, 'The node was loaded successfully.');
|
||||
$this->assertEqual($node->field_image[LANGUAGE_NONE][0]['filename'], $image->filename, 'The image was uploaded successfully.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests file submission for an anonymous visitor with a missing node title.
|
||||
*/
|
||||
function testAnonymousNodeWithFileWithoutTitle() {
|
||||
$this->drupalLogout();
|
||||
$this->_testNodeWithFileWithoutTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests file submission for an authenticated user with a missing node title.
|
||||
*/
|
||||
function testAuthenticatedNodeWithFileWithoutTitle() {
|
||||
$admin_user = $this->drupalCreateUser(array(
|
||||
'bypass node access',
|
||||
'access content overview',
|
||||
'administer nodes',
|
||||
));
|
||||
$this->drupalLogin($admin_user);
|
||||
$this->_testNodeWithFileWithoutTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to test file submissions with missing node titles.
|
||||
*/
|
||||
protected function _testNodeWithFileWithoutTitle() {
|
||||
$bundle_label = 'Article';
|
||||
$node_title = 'Test page';
|
||||
|
||||
// Load the node form.
|
||||
$this->drupalGet('node/add/article');
|
||||
$this->assertResponse(200, 'Loaded the article node form.');
|
||||
$this->assertText(strip_tags(t('Create @name', array('@name' => $bundle_label))));
|
||||
|
||||
// Generate an image file.
|
||||
$image = $this->getTestImage();
|
||||
|
||||
// Submit the form but exclude the title field.
|
||||
$edit = array(
|
||||
'body[und][0][value]' => 'Test article',
|
||||
'body[und][0][format]' => 'filtered_html',
|
||||
'files[field_image_und_0]' => drupal_realpath($image->uri),
|
||||
);
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
$this->assertResponse(200);
|
||||
$t_args = array('@type' => $bundle_label, '%title' => $node_title);
|
||||
$this->assertNoText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
|
||||
$this->assertText(t('!name field is required.', array('!name' => t('Title'))));
|
||||
|
||||
// Submit the form again but this time with the missing title field. This
|
||||
// should still work.
|
||||
$edit = array(
|
||||
'title' => $node_title,
|
||||
);
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
|
||||
// Confirm the final submission actually worked.
|
||||
$t_args = array('@type' => $bundle_label, '%title' => $node_title);
|
||||
$this->assertText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
|
||||
$matches = array();
|
||||
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
|
||||
$nid = end($matches);
|
||||
$this->assertNotEqual($nid, 0, 'The node ID was extracted from the URL.');
|
||||
$node = node_load($nid);
|
||||
$this->assertNotEqual($node, NULL, 'The node was loaded successfully.');
|
||||
$this->assertEqual($node->field_image[LANGUAGE_NONE][0]['filename'], $image->filename, 'The image was uploaded successfully.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a test image.
|
||||
*
|
||||
* @return stdClass
|
||||
* A file object.
|
||||
*/
|
||||
function getTestImage() {
|
||||
// Get a file to upload.
|
||||
$file = current($this->drupalGetTestFiles('image'));
|
||||
|
||||
// Add a filesize property to files as would be read by file_load().
|
||||
$file->filesize = filesize($file->uri);
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -7,8 +7,8 @@ files[] = filter.test
|
||||
required = TRUE
|
||||
configure = admin/config/content/formats
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -1120,8 +1120,12 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
|
||||
$f = filter_xss("<img src=\"jav\0a\0\0cript:alert(0)\">", array('img'));
|
||||
$this->assertNoNormalized($f, 'cript', 'HTML scheme clearing evasion -- embedded nulls.');
|
||||
|
||||
$f = filter_xss('<img src="  javascript:alert(0)">', array('img'));
|
||||
$this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- spaces and metacharacters before scheme.');
|
||||
// @todo This dataset currently fails under 5.4 because of
|
||||
// https://www.drupal.org/node/1210798. Restore after it's fixed.
|
||||
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
|
||||
$f = filter_xss('<img src="  javascript:alert(0)">', array('img'));
|
||||
$this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- spaces and metacharacters before scheme.');
|
||||
}
|
||||
|
||||
$f = filter_xss('<img src="vbscript:msgbox(0)">', array('img'));
|
||||
$this->assertNoNormalized($f, 'vbscript', 'HTML scheme clearing evasion -- another scheme.');
|
||||
|
@@ -9,8 +9,8 @@ files[] = forum.test
|
||||
configure = admin/structure/forum
|
||||
stylesheets[all][] = forum.css
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = help.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -7,8 +7,8 @@ dependencies[] = file
|
||||
files[] = image.test
|
||||
configure = admin/config/media/image-styles
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -32,7 +32,7 @@ class ImageFieldTestCase extends DrupalWebTestCase {
|
||||
|
||||
function setUp() {
|
||||
parent::setUp('image');
|
||||
$this->admin_user = $this->drupalCreateUser(array('access content', 'access administration pages', 'administer site configuration', 'administer content types', 'administer nodes', 'create article content', 'edit any article content', 'delete any article content', 'administer image styles'));
|
||||
$this->admin_user = $this->drupalCreateUser(array('access content', 'access administration pages', 'administer site configuration', 'administer content types', 'administer nodes', 'create article content', 'edit any article content', 'delete any article content', 'administer image styles', 'administer fields'));
|
||||
$this->drupalLogin($this->admin_user);
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
|
||||
$this->assertEqual($this->drupalGetHeader('Content-Length'), $generated_image_info['file_size'], 'Expected Content-Length was reported.');
|
||||
if ($scheme == 'private') {
|
||||
$this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.');
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'no-cache, must-revalidate, post-check=0, pre-check=0', 'Cache-Control header was set to prevent caching.');
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'no-cache, must-revalidate', 'Cache-Control header was set to prevent caching.');
|
||||
$this->assertEqual($this->drupalGetHeader('X-Image-Owned-By'), 'image_module_test', 'Expected custom header has been added.');
|
||||
|
||||
// Make sure that a second request to the already existing derivate works
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = image_module_test.module
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -1194,7 +1194,7 @@ function locale_translate_edit_form_submit($form, &$form_state) {
|
||||
$translation = db_query("SELECT translation FROM {locales_target} WHERE lid = :lid AND language = :language", array(':lid' => $lid, ':language' => $key))->fetchField();
|
||||
if (!empty($value)) {
|
||||
// Only update or insert if we have a value to use.
|
||||
if (!empty($translation)) {
|
||||
if (is_string($translation)) {
|
||||
db_update('locales_target')
|
||||
->fields(array(
|
||||
'translation' => $value,
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = locale.test
|
||||
configure = admin/config/regional/language
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -393,6 +393,16 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
|
||||
// The indicator should not be here.
|
||||
$this->assertNoRaw($language_indicator, 'String is translated.');
|
||||
|
||||
// Verify that a translation set which has an empty target string can be
|
||||
// updated without any database error.
|
||||
db_update('locales_target')
|
||||
->fields(array('translation' => ''))
|
||||
->condition('language', $langcode, '=')
|
||||
->condition('lid', $lid, '=')
|
||||
->execute();
|
||||
$this->drupalPost('admin/config/regional/translate/edit/' . $lid, $edit, t('Save translations'));
|
||||
$this->assertText(t('The string has been saved.'), 'The string has been saved.');
|
||||
|
||||
// Try to edit a non-existent string and ensure we're redirected correctly.
|
||||
// Assuming we don't have 999,999 strings already.
|
||||
$random_lid = 999999;
|
||||
@@ -2237,6 +2247,37 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
|
||||
|
||||
$this->drupalLogout();
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that nodes may be created with different languages.
|
||||
*/
|
||||
function testNodeCreationWithLanguage() {
|
||||
// Create an admin user and log them in.
|
||||
$perms = array(
|
||||
// Standard node permissions.
|
||||
'create page content',
|
||||
'administer content types',
|
||||
'administer nodes',
|
||||
'bypass node access',
|
||||
// Locale.
|
||||
'administer languages',
|
||||
);
|
||||
$web_user = $this->drupalCreateUser($perms);
|
||||
$this->drupalLogin($web_user);
|
||||
|
||||
// Create some test nodes using different langcodes.
|
||||
foreach (array(LANGUAGE_NONE, 'en', 'fr') as $langcode) {
|
||||
$node_args = array(
|
||||
'type' => 'page',
|
||||
'promote' => 1,
|
||||
'language' => $langcode,
|
||||
);
|
||||
$node = $this->drupalCreateNode($node_args);
|
||||
$node_reloaded = node_load($node->nid, NULL, TRUE);
|
||||
$this->assertEqual($node_reloaded->language, $langcode, format_string('The language code of the node was successfully set to @langcode.', array('@langcode' => $langcode)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2629,6 +2670,68 @@ class LocaleUrlRewritingTest extends DrupalWebTestCase {
|
||||
$this->drupalGet("$prefix/$path");
|
||||
$this->assertResponse(404, $message2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check URL rewriting when using a domain name and a non-standard port.
|
||||
*/
|
||||
function testDomainNameNegotiationPort() {
|
||||
$language_domain = 'example.fr';
|
||||
$edit = array(
|
||||
'locale_language_negotiation_url_part' => 1,
|
||||
);
|
||||
$this->drupalPost('admin/config/regional/language/configure/url', $edit, t('Save configuration'));
|
||||
$edit = array(
|
||||
'prefix' => '',
|
||||
'domain' => $language_domain
|
||||
);
|
||||
$this->drupalPost('admin/config/regional/language/edit/fr', $edit, t('Save language'));
|
||||
|
||||
// Enable domain configuration.
|
||||
variable_set('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN);
|
||||
|
||||
// Reset static caching.
|
||||
drupal_static_reset('language_list');
|
||||
drupal_static_reset('language_url_outbound_alter');
|
||||
drupal_static_reset('language_url_rewrite_url');
|
||||
|
||||
// In case index.php is part of the URLs, we need to adapt the asserted
|
||||
// URLs as well.
|
||||
$index_php = strpos(url('', array('absolute' => TRUE)), 'index.php') !== FALSE;
|
||||
|
||||
// Remember current HTTP_HOST.
|
||||
$http_host = $_SERVER['HTTP_HOST'];
|
||||
|
||||
// Fake a different port.
|
||||
$_SERVER['HTTP_HOST'] .= ':88';
|
||||
|
||||
// Create an absolute French link.
|
||||
$languages = language_list();
|
||||
$language = $languages['fr'];
|
||||
$url = url('', array(
|
||||
'absolute' => TRUE,
|
||||
'language' => $language
|
||||
));
|
||||
|
||||
$expected = 'http://example.fr:88/';
|
||||
$expected .= $index_php ? 'index.php/' : '';
|
||||
|
||||
$this->assertEqual($url, $expected, 'The right port is used.');
|
||||
|
||||
// If we set the port explicitly in url(), it should not be overriden.
|
||||
$url = url('', array(
|
||||
'absolute' => TRUE,
|
||||
'language' => $language,
|
||||
'base_url' => $GLOBALS['base_url'] . ':90',
|
||||
));
|
||||
|
||||
$expected = 'http://example.fr:90/';
|
||||
$expected .= $index_php ? 'index.php/' : '';
|
||||
|
||||
$this->assertEqual($url, $expected, 'A given port is not overriden.');
|
||||
|
||||
// Restore HTTP_HOST.
|
||||
$_SERVER['HTTP_HOST'] = $http_host;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3141,3 +3244,46 @@ class LocaleCSSAlterTest extends DrupalWebTestCase {
|
||||
$this->assertRaw('@import url("' . $base_url . '/modules/system/system.messages.css' . $query_string . '");' . "\n" . '@import url("' . $base_url . '/modules/system/system.messages-rtl.css' . $query_string . '");' . "\n", 'CSS: system.messages-rtl.css is added directly after system.messages.css.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests locale translation safe string handling.
|
||||
*/
|
||||
class LocaleStringIsSafeTest extends DrupalWebTestCase {
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Test if a string is safe',
|
||||
'description' => 'Tests locale translation safe string handling.',
|
||||
'group' => 'Locale',
|
||||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp('locale');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for locale_string_is_safe().
|
||||
*/
|
||||
public function testLocaleStringIsSafe() {
|
||||
// Check a translatable string without HTML.
|
||||
$string = 'Hello world!';
|
||||
$result = locale_string_is_safe($string);
|
||||
$this->assertTrue($result);
|
||||
|
||||
// Check a translatable string which includes trustable HTML.
|
||||
$string = 'Hello <strong>world</strong>!';
|
||||
$result = locale_string_is_safe($string);
|
||||
$this->assertTrue($result);
|
||||
|
||||
// Check an untranslatable string which includes untrustable HTML (according
|
||||
// to the locale_string_is_safe() function definition).
|
||||
$string = 'Hello <img src="world.png" alt="world" />!';
|
||||
$result = locale_string_is_safe($string);
|
||||
$this->assertFalse($result);
|
||||
|
||||
// Check a translatable string which includes a token in an href attribute.
|
||||
$string = 'Hi <a href="[current-user:url]">user</a>';
|
||||
$result = locale_string_is_safe($string);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -281,6 +281,7 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) {
|
||||
$form['link_title'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Menu link title'),
|
||||
'#maxlength' => 255,
|
||||
'#default_value' => $item['link_title'],
|
||||
'#description' => t('The text to be used for this link in the menu.'),
|
||||
'#required' => TRUE,
|
||||
@@ -305,7 +306,7 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) {
|
||||
'#title' => t('Path'),
|
||||
'#maxlength' => 255,
|
||||
'#default_value' => $path,
|
||||
'#description' => t('The path for this menu link. This can be an internal Drupal path such as %add-node or an external URL such as %drupal. Enter %front to link to the front page.', array('%front' => '<front>', '%add-node' => 'node/add', '%drupal' => 'http://drupal.org')),
|
||||
'#description' => t('The path for this menu link. This can be an internal path such as %add-node or an external URL such as %example. Enter %front to link to the front page.', array('%front' => '<front>', '%add-node' => 'node/add', '%example' => 'http://example.com')),
|
||||
'#required' => TRUE,
|
||||
);
|
||||
$form['actions']['delete'] = array(
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = menu.test
|
||||
configure = admin/structure/menu
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -674,6 +674,7 @@ function menu_form_node_form_alter(&$form, $form_state) {
|
||||
$form['menu']['link']['link_title'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Menu link title'),
|
||||
'#maxlength' => 255,
|
||||
'#default_value' => $link['link_title'],
|
||||
);
|
||||
|
||||
|
@@ -648,7 +648,12 @@ class MenuNodeTestCase extends DrupalWebTestCase {
|
||||
);
|
||||
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
|
||||
|
||||
// Create a node.
|
||||
// Verify that the menu link title on the node add form has the correct
|
||||
// maxlength.
|
||||
$this->drupalGet('node/add/page');
|
||||
$this->assertPattern('/<input .* id="edit-menu-link-title" .* maxlength="255" .* \/>/', 'Menu link title field has correct maxlength in node add form.');
|
||||
|
||||
// Create a node with menu link disabled.
|
||||
$node_title = $this->randomName();
|
||||
$language = LANGUAGE_NONE;
|
||||
$edit = array(
|
||||
@@ -684,6 +689,10 @@ class MenuNodeTestCase extends DrupalWebTestCase {
|
||||
$this->drupalGet('node/' . $node->nid . '/edit');
|
||||
$this->assertOptionSelected('edit-menu-weight', 17, 'Menu weight correct in edit form');
|
||||
|
||||
// Verify that the menu link title on the node edit form has the correct
|
||||
// maxlength.
|
||||
$this->assertPattern('/<input .* id="edit-menu-link-title" .* maxlength="255" .* \/>/', 'Menu link title field has correct maxlength in node edit form.');
|
||||
|
||||
// Edit the node and remove the menu link.
|
||||
$edit = array(
|
||||
'menu[enabled]' => FALSE,
|
||||
|
@@ -11,7 +11,7 @@
|
||||
function node_overview_types() {
|
||||
$types = node_type_get_types();
|
||||
$names = node_type_get_names();
|
||||
$field_ui = module_exists('field_ui');
|
||||
$field_ui = module_exists('field_ui') && user_access('administer fields');
|
||||
$header = array(t('Name'), array('data' => t('Operations'), 'colspan' => $field_ui ? '4' : '2'));
|
||||
$rows = array();
|
||||
|
||||
|
@@ -9,8 +9,8 @@ required = TRUE
|
||||
configure = admin/structure/types
|
||||
stylesheets[all][] = node.css
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -410,6 +410,7 @@ function node_schema() {
|
||||
'nid' => array(
|
||||
'description' => 'The {node}.nid that was read.',
|
||||
'type' => 'int',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
),
|
||||
@@ -943,6 +944,23 @@ function node_update_7015() {
|
||||
->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Change {history}.nid to an unsigned int in order to match {node}.nid.
|
||||
*/
|
||||
function node_update_7016() {
|
||||
db_drop_primary_key('history');
|
||||
db_drop_index('history', 'nid');
|
||||
db_change_field('history', 'nid', 'nid', array(
|
||||
'description' => 'The {node}.nid that was read.',
|
||||
'type' => 'int',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
));
|
||||
db_add_primary_key('history', array('uid', 'nid'));
|
||||
db_add_index('history', 'nid', array('nid'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-7.x-extra".
|
||||
*/
|
||||
|
@@ -1518,7 +1518,7 @@ class NodeTypeTestCase extends DrupalWebTestCase {
|
||||
* Tests editing a node type using the UI.
|
||||
*/
|
||||
function testNodeTypeEditing() {
|
||||
$web_user = $this->drupalCreateUser(array('bypass node access', 'administer content types'));
|
||||
$web_user = $this->drupalCreateUser(array('bypass node access', 'administer content types', 'administer fields'));
|
||||
$this->drupalLogin($web_user);
|
||||
|
||||
$instance = field_info_instance('node', 'body', 'page');
|
||||
@@ -2768,8 +2768,8 @@ class NodeAccessFieldTestCase extends NodeWebTestCase {
|
||||
node_access_rebuild();
|
||||
|
||||
// Create some users.
|
||||
$this->admin_user = $this->drupalCreateUser(array('access content', 'bypass node access'));
|
||||
$this->content_admin_user = $this->drupalCreateUser(array('access content', 'administer content types'));
|
||||
$this->admin_user = $this->drupalCreateUser(array('access content', 'bypass node access', 'administer fields'));
|
||||
$this->content_admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer fields'));
|
||||
|
||||
// Add a custom field to the page content type.
|
||||
$this->field_name = drupal_strtolower($this->randomName() . '_field_name');
|
||||
@@ -2986,3 +2986,36 @@ class NodePageCacheTest extends NodeWebTestCase {
|
||||
$this->assertResponse(404);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that multi-byte UTF-8 characters are stored and retrieved correctly.
|
||||
*/
|
||||
class NodeMultiByteUtf8Test extends NodeWebTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Multi-byte UTF-8',
|
||||
'description' => 'Test that multi-byte UTF-8 characters are stored and retrieved correctly.',
|
||||
'group' => 'Node',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that multi-byte UTF-8 characters are stored and retrieved correctly.
|
||||
*/
|
||||
public function testMultiByteUtf8() {
|
||||
$connection = Database::getConnection();
|
||||
// On MySQL, this test will only run if 'charset' is set to 'utf8mb4' in
|
||||
// settings.php.
|
||||
if (!($connection->utf8mb4IsSupported() && $connection->utf8mb4IsActive())) {
|
||||
return;
|
||||
}
|
||||
$title = '🐙';
|
||||
$this->assertTrue(drupal_strlen($title, 'utf-8') < strlen($title), 'Title has multi-byte characters.');
|
||||
$node = $this->drupalCreateNode(array('title' => $title));
|
||||
$this->drupalGet('node/' . $node->nid);
|
||||
$result = $this->xpath('//h1[@id="page-title"]');
|
||||
$this->assertEqual(trim((string) $result[0]), $title, 'The passed title was returned.');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Core
|
||||
core = 7.x
|
||||
files[] = openid.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -680,11 +680,11 @@ class OpenIDTestCase extends DrupalWebTestCase {
|
||||
* Test _openid_dh_XXX_to_XXX() functions.
|
||||
*/
|
||||
function testConversion() {
|
||||
$this->assertEqual(_openid_dh_long_to_base64('12345678901234567890123456789012345678901234567890'), 'CHJ/Y2mq+DyhUCZ0evjH8ZbOPwrS', '_openid_dh_long_to_base64() returned expected result.');
|
||||
$this->assertEqual(_openid_dh_base64_to_long('BsH/g8Nrpn2dtBSdu/sr1y8hxwyx'), '09876543210987654321098765432109876543210987654321', '_openid_dh_base64_to_long() returned expected result.');
|
||||
$this->assertIdentical(_openid_dh_long_to_base64('12345678901234567890123456789012345678901234567890'), 'CHJ/Y2mq+DyhUCZ0evjH8ZbOPwrS', '_openid_dh_long_to_base64() returned expected result.');
|
||||
$this->assertIdentical(_openid_dh_base64_to_long('BsH/g8Nrpn2dtBSdu/sr1y8hxwyx'), '9876543210987654321098765432109876543210987654321', '_openid_dh_base64_to_long() returned expected result.');
|
||||
|
||||
$this->assertEqual(_openid_dh_long_to_binary('12345678901234567890123456789012345678901234567890'), "\x08r\x7fci\xaa\xf8<\xa1P&tz\xf8\xc7\xf1\x96\xce?\x0a\xd2", '_openid_dh_long_to_binary() returned expected result.');
|
||||
$this->assertEqual(_openid_dh_binary_to_long("\x06\xc1\xff\x83\xc3k\xa6}\x9d\xb4\x14\x9d\xbb\xfb+\xd7/!\xc7\x0c\xb1"), '09876543210987654321098765432109876543210987654321', '_openid_dh_binary_to_long() returned expected result.');
|
||||
$this->assertIdentical(_openid_dh_long_to_binary('12345678901234567890123456789012345678901234567890'), "\x08r\x7fci\xaa\xf8<\xa1P&tz\xf8\xc7\xf1\x96\xce?\x0a\xd2", '_openid_dh_long_to_binary() returned expected result.');
|
||||
$this->assertIdentical(_openid_dh_binary_to_long("\x06\xc1\xff\x83\xc3k\xa6}\x9d\xb4\x14\x9d\xbb\xfb+\xd7/!\xc7\x0c\xb1"), '9876543210987654321098765432109876543210987654321', '_openid_dh_binary_to_long() returned expected result.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = openid
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -4,8 +4,8 @@ package = Core
|
||||
version = VERSION
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -78,6 +78,20 @@ function overlay_theme() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_alter().
|
||||
*/
|
||||
function overlay_form_alter(&$form, &$form_state) {
|
||||
// Add a hidden element to prevent dropping out of the overlay when a form is
|
||||
// submitted inside the overlay using a GET method.
|
||||
if (isset($form['#method']) && $form['#method'] == 'get' && isset($_REQUEST['render']) && $_REQUEST['render'] == 'overlay' && !isset($form['render'])) {
|
||||
$form['render'] = array(
|
||||
'#type' => 'hidden',
|
||||
'#value' => 'overlay',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*/
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = path.test
|
||||
configure = admin/config/search/path
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = php.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = poll.test
|
||||
stylesheets[all][] = poll.css
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -11,8 +11,8 @@ configure = admin/config/people/profile
|
||||
; See user_system_info_alter().
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
files[] = rdf.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -4,9 +4,10 @@ package = Testing
|
||||
version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
dependencies[] = blog
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -30,8 +30,9 @@
|
||||
*
|
||||
* @return
|
||||
* Array with optional keys:
|
||||
* - title: Title for the tab on the search page for this module. Defaults
|
||||
* to the module name if not given.
|
||||
* - title: Title for the tab on the search page for this module. Title must
|
||||
* be untranslated. Outside of this return array, pass the title through the
|
||||
* t() function to register it as a translatable string.
|
||||
* - path: Path component after 'search/' for searching with this module.
|
||||
* Defaults to the module name if not given.
|
||||
* - conditions_callback: An implementation of callback_search_conditions().
|
||||
@@ -39,6 +40,9 @@
|
||||
* @ingroup search
|
||||
*/
|
||||
function hook_search_info() {
|
||||
// Make the title translatable.
|
||||
t('Content');
|
||||
|
||||
return array(
|
||||
'title' => 'Content',
|
||||
'path' => 'node',
|
||||
|
@@ -8,8 +8,8 @@ files[] = search.test
|
||||
configure = admin/config/search/settings
|
||||
stylesheets[all][] = search.css
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = shortcut.test
|
||||
configure = admin/config/user-interface/shortcut
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -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');
|
||||
@@ -1693,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();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2760,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.
|
||||
|
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 |
@@ -57,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 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -374,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;
|
||||
}
|
||||
}
|
||||
|
@@ -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 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -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));
|
||||
@@ -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.');
|
||||
|
||||
@@ -379,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.
|
||||
*/
|
||||
@@ -414,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -947,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');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1254,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.
|
||||
|
@@ -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 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
@@ -7,8 +7,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
; Information added by Drupal.org packaging script on 2016-10-05
|
||||
version = "7.51"
|
||||
project = "drupal"
|
||||
datestamp = "1456343506"
|
||||
datestamp = "1475694174"
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user