contrib modules security updates
This commit is contained in:
@@ -50,6 +50,21 @@ class ViewsHandlerFilterDateTest extends ViewsSqlTest {
|
||||
$this->assertIdenticalResultset($view, $expected_result, $this->map);
|
||||
$view->destroy();
|
||||
|
||||
// Test "first day of" type of relative dates for simple operator.
|
||||
$view->set_display('default');
|
||||
$view->init_handlers();
|
||||
$view->filter['created']->operator = '<';
|
||||
$view->filter['created']->value['type'] = 'offset';
|
||||
$view->filter['created']->value['value'] = 'last day of January 1970';
|
||||
$view->execute_display('default');
|
||||
$expected_result = array(
|
||||
array('nid' => $this->nodes[0]->nid),
|
||||
array('nid' => $this->nodes[1]->nid),
|
||||
array('nid' => $this->nodes[2]->nid),
|
||||
);
|
||||
$this->assertIdenticalResultset($view, $expected_result, $this->map);
|
||||
$view->destroy();
|
||||
|
||||
// Test offset for between operator.
|
||||
$view->set_display('default');
|
||||
$view->init_handlers();
|
||||
@@ -63,6 +78,22 @@ class ViewsHandlerFilterDateTest extends ViewsSqlTest {
|
||||
);
|
||||
$this->assertIdenticalResultset($view, $expected_result, $this->map);
|
||||
$view->destroy();
|
||||
|
||||
// Test "first day of" type of relative dates for between operator.
|
||||
$view->set_display('default');
|
||||
$view->init_handlers();
|
||||
$view->filter['created']->operator = 'between';
|
||||
$view->filter['created']->value['type'] = 'offset';
|
||||
$view->filter['created']->value['max'] = 'last day of January 1970';
|
||||
$view->filter['created']->value['min'] = 'first day of January 1970';
|
||||
$view->execute_display('default');
|
||||
$expected_result = array(
|
||||
array('nid' => $this->nodes[0]->nid),
|
||||
array('nid' => $this->nodes[1]->nid),
|
||||
array('nid' => $this->nodes[2]->nid),
|
||||
);
|
||||
$this->assertIdenticalResultset($view, $expected_result, $this->map);
|
||||
$view->destroy();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -241,7 +241,7 @@ class ViewsPluginStyleTestCase extends ViewsPluginStyleTestBase {
|
||||
// Setup some random css class.
|
||||
$view->init_display();
|
||||
$view->init_style();
|
||||
$random_name = $this->randomName();
|
||||
$random_name = drupal_html_class($this->randomName());
|
||||
$view->style_plugin->options['row_class'] = $random_name . " test-token-[name]";
|
||||
|
||||
$rendered_output = $view->preview();
|
||||
@@ -255,7 +255,7 @@ class ViewsPluginStyleTestCase extends ViewsPluginStyleTestBase {
|
||||
$this->assertTrue(strpos($class, $random_name) !== FALSE, 'Take sure that a custom css class is added to the output.');
|
||||
|
||||
// Check token replacement.
|
||||
$name = $view->field['name']->get_value($view->result[$count]);
|
||||
$name = drupal_html_class($view->field['name']->get_value($view->result[$count]));
|
||||
$this->assertTrue(strpos($class, "test-token-$name") !== FALSE, 'Take sure that a token in custom css class is replaced.');
|
||||
|
||||
$count++;
|
||||
|
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Main view template.
|
||||
*
|
||||
* Variables available:
|
||||
* - $classes_array: An array of classes determined in
|
||||
* template_preprocess_views_view(). Default classes are:
|
||||
* .view
|
||||
* .view-[css_name]
|
||||
* .view-id-[view_name]
|
||||
* .view-display-id-[display_name]
|
||||
* .view-dom-id-[dom_id]
|
||||
* - $classes: A string version of $classes_array for use in the class attribute
|
||||
* - $css_name: A css-safe version of the view name.
|
||||
* - $css_class: The user-specified classes names, if any
|
||||
* - $header: The view header
|
||||
* - $footer: The view footer
|
||||
* - $rows: The results of the view query, if any
|
||||
* - $empty: The empty text to display if the view is empty
|
||||
* - $pager: The pager next/prev links to display, if any
|
||||
* - $exposed: Exposed widget form/info to display
|
||||
* - $feed_icon: Feed icon to display, if any
|
||||
* - $more: A link to view more, if any
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<div class="<?php print $classes; ?>">
|
||||
<?php if ($header): ?>
|
||||
<div class="view-header">
|
||||
<?php print $header; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($exposed): ?>
|
||||
<div class="view-filters">
|
||||
<?php print $exposed; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($attachment_before): ?>
|
||||
<div class="attachment attachment-before">
|
||||
<?php print $attachment_before; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($rows): ?>
|
||||
<div class="view-content">
|
||||
<?php print $rows; ?>
|
||||
</div>
|
||||
<?php elseif ($empty): ?>
|
||||
<div class="view-empty">
|
||||
<?php print $empty; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($pager): ?>
|
||||
<?php print $pager; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($attachment_after): ?>
|
||||
<div class="attachment attachment-after">
|
||||
<?php print $attachment_after; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($more): ?>
|
||||
<?php print $more; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($footer): ?>
|
||||
<div class="view-footer">
|
||||
<?php print $footer; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($feed_icon): ?>
|
||||
<div class="feed-icon">
|
||||
<?php print $feed_icon; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div> <?php /* class view */ ?>
|
@@ -108,11 +108,14 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $group_by
|
||||
* Which group_by function should be used, for example sum or count.
|
||||
* @param string|null $group_by
|
||||
* (optional) Which group_by function should be used, for example sum or
|
||||
* count. If omitted, the aggregation is tested with no group function.
|
||||
* @param array|null $values
|
||||
* (optional) Expected values.
|
||||
*/
|
||||
function GroupByTestHelper($group_by, $values) {
|
||||
// Create 2 nodes of type1 and 3 nodes of type2
|
||||
function GroupByTestHelper($group_by = NULL, $values = NULL) {
|
||||
// Create 4 nodes of type1 and 3 nodes of type2
|
||||
$type1 = $this->drupalCreateContentType();
|
||||
$type2 = $this->drupalCreateContentType();
|
||||
|
||||
@@ -136,6 +139,19 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
|
||||
$output = $view->execute_display();
|
||||
|
||||
$this->assertEqual(count($view->result), 2, 'Make sure the count of items is right.');
|
||||
|
||||
$results = array();
|
||||
// There's no need for a function in order to have aggregation.
|
||||
if (empty($group_by)) {
|
||||
$types = array($type1->type, $type2->type);
|
||||
$results = array_map(function ($item) { return $item->node_type; }, $view->result);
|
||||
sort($types);
|
||||
sort($results);
|
||||
$this->assertIdentical($results, $types);
|
||||
// Exit here with no aggregation function.
|
||||
return;
|
||||
}
|
||||
|
||||
// Group by nodetype to identify the right count.
|
||||
foreach ($view->result as $item) {
|
||||
$results[$item->node_type] = $item->nid;
|
||||
@@ -144,7 +160,7 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
|
||||
$this->assertEqual($results[$type2->type], $values[1]);
|
||||
}
|
||||
|
||||
function viewsGroupByViewHelper($group_by) {
|
||||
function viewsGroupByViewHelper($group_by = NULL) {
|
||||
$view = new view;
|
||||
$view->name = 'group_by_count';
|
||||
$view->description = '';
|
||||
@@ -164,21 +180,27 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
|
||||
$handler->display->display_options['pager']['type'] = 'some';
|
||||
$handler->display->display_options['style_plugin'] = 'default';
|
||||
$handler->display->display_options['row_plugin'] = 'fields';
|
||||
/* Field: Content: Nid */
|
||||
$handler->display->display_options['fields']['nid']['id'] = 'nid';
|
||||
$handler->display->display_options['fields']['nid']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['nid']['field'] = 'nid';
|
||||
$handler->display->display_options['fields']['nid']['group_type'] = $group_by;
|
||||
$handler->display->display_options['fields']['nid']['alter']['alter_text'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['alter']['make_link'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['alter']['trim'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['alter']['word_boundary'] = 1;
|
||||
$handler->display->display_options['fields']['nid']['alter']['ellipsis'] = 1;
|
||||
$handler->display->display_options['fields']['nid']['alter']['strip_tags'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['alter']['html'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['hide_empty'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['empty_zero'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['link_to_node'] = 0;
|
||||
|
||||
// The test view has 2 fields ('nid' and 'type'). Don't add 'nid' when
|
||||
// having no aggregation function. We just want to aggregate on node type.
|
||||
if (!empty($group_by)) {
|
||||
/* Field: Content: Nid */
|
||||
$handler->display->display_options['fields']['nid']['id'] = 'nid';
|
||||
$handler->display->display_options['fields']['nid']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['nid']['field'] = 'nid';
|
||||
$handler->display->display_options['fields']['nid']['group_type'] = $group_by;
|
||||
$handler->display->display_options['fields']['nid']['alter']['alter_text'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['alter']['make_link'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['alter']['trim'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['alter']['word_boundary'] = 1;
|
||||
$handler->display->display_options['fields']['nid']['alter']['ellipsis'] = 1;
|
||||
$handler->display->display_options['fields']['nid']['alter']['strip_tags'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['alter']['html'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['hide_empty'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['empty_zero'] = 0;
|
||||
$handler->display->display_options['fields']['nid']['link_to_node'] = 0;
|
||||
}
|
||||
|
||||
/* Field: Content: Type */
|
||||
$handler->display->display_options['fields']['type']['id'] = 'type';
|
||||
$handler->display->display_options['fields']['type']['table'] = 'node';
|
||||
@@ -218,6 +240,10 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
|
||||
$this->GroupByTestHelper('max', array(4, 7));
|
||||
}
|
||||
|
||||
function testGroupByNone() {
|
||||
$this->GroupByTestHelper();
|
||||
}
|
||||
|
||||
public function testGroupByCountOnlyFilters() {
|
||||
// Check if GROUP BY and HAVING are included when a view
|
||||
// Doesn't display SUM, COUNT, MAX... functions in SELECT statment
|
||||
|
@@ -194,6 +194,30 @@ class ViewsModuleTest extends ViewsSqlTest {
|
||||
$this->assertEqual(variable_get('views_test_views_data_count', 0), 1, 'Views data rebuilt once');
|
||||
$this->assertFalse(drupal_static('_views_fetch_data_fully_loaded'), 'Views data is not fully loaded');
|
||||
|
||||
|
||||
// Test if the cache consistency is ensured. There was an issue where
|
||||
// calling _views_fetch_data() first with a table would prevent the function
|
||||
// from properly rebuilt a missing the general cache entry.
|
||||
// See https://www.drupal.org/node/2475669 for details.
|
||||
// Make sure we start with a empty cache.
|
||||
$this->resetStaticViewsDataCache();
|
||||
cache_clear_all('*', 'cache_views', TRUE);
|
||||
|
||||
// Prime the static cache of _views_fetch_data() by calling it with a table
|
||||
// first.
|
||||
views_fetch_data('views_test');
|
||||
// Now remove the general cache.
|
||||
cache_clear_all('views_data:en', 'cache_views');
|
||||
// Reset the static cache to see if fetches from the persistent cache
|
||||
// properly rebuild the static cache.
|
||||
$this->resetStaticViewsDataCache();
|
||||
// Prime the static cache of _views_fetch_data() by calling it with a table
|
||||
// first.
|
||||
views_fetch_data('views_test');
|
||||
// Fetch the general cache, which was deleted, an see if it is rebuild
|
||||
// properly.
|
||||
views_fetch_data();
|
||||
$this->assertTrue(cache_get('views_data:en', 'cache_views'), 'Cache for all tables was properly rebuild.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -132,7 +132,6 @@ abstract class ViewsSqlTest extends ViewsTestCase {
|
||||
variable_set('views_test_schema', $this->schemaDefinition());
|
||||
variable_set('views_test_views_data', $this->viewsData());
|
||||
variable_set('views_test_views_plugins', $this->viewsPlugins());
|
||||
|
||||
module_enable(array('views_test'));
|
||||
$this->resetAll();
|
||||
|
||||
|
@@ -5,9 +5,9 @@ core = 7.x
|
||||
dependencies[] = views
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-02-11
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2016-06-15
|
||||
version = "7.x-3.14"
|
||||
core = "7.x"
|
||||
project = "views"
|
||||
datestamp = "1423648085"
|
||||
datestamp = "1466019588"
|
||||
|
||||
|
@@ -23,7 +23,7 @@ function views_test_permission() {
|
||||
function views_test_views_api() {
|
||||
return array(
|
||||
'api' => 3.0,
|
||||
'template path' => drupal_get_path('module', 'views_test') . '/templates',
|
||||
'template path' => drupal_get_path('module', 'views') . '/test_templates',
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user