Update to Drupal 8.1.1. For more information, see https://www.drupal.org/node/2718713

This commit is contained in:
Pantheon Automation 2016-05-04 14:35:41 -07:00 committed by Greg Anderson
parent c0a0d5a94c
commit 9eae24d844
669 changed files with 3873 additions and 1553 deletions

View file

@ -496,7 +496,7 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac
$views_field['title'] = $this->t('Translation language');
}
if ($table == $this->entityType->getBaseTable() || $table == $this->entityType->getRevisionTable()) {
$views_field['title'] = $this->t('Original language');
$views_field['title'] = $this->t('Original language');
}
}
}

View file

@ -269,7 +269,6 @@ class ViewsEntitySchemaSubscriber implements EntityTypeListenerInterface, EventS
}
/**
*
* Updates views if a data table is renamed.
*
* @param \Drupal\views\Entity\View[] $all_views

View file

@ -101,7 +101,7 @@ class ViewsHandlerManager extends DefaultPluginManager implements FallbackPlugin
}
// @todo This is crazy. Find a way to remove the override functionality.
$plugin_id = $override ? : $definition['id'];
$plugin_id = $override ?: $definition['id'];
// Try to use the overridden handler.
$handler = $this->createInstance($plugin_id, $definition);
if ($override && method_exists($handler, 'broken') && $handler->broken()) {

View file

@ -259,7 +259,7 @@ abstract class HandlerBase extends PluginBase implements ViewsHandlerInterface {
$form['admin_label'] = array(
'#type' => 'details',
'#title' =>$this->t('Administrative title'),
'#title' => $this->t('Administrative title'),
'#weight' => 150,
);
$form['admin_label']['admin_label'] = array(

View file

@ -51,34 +51,32 @@ abstract class ArgumentValidatorPluginBase extends PluginBase {
}
/**
* Retrieve the options when this is a new access
* control plugin
* Retrieves the options when this is a new access control plugin.
*/
protected function defineOptions() { return array(); }
/**
* Provide the default form for setting options.
* Provides the default form for setting options.
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) { }
/**
* Provide the default form form for validating options
* Provides the default form for validating options.
*/
public function validateOptionsForm(&$form, FormStateInterface $form_state) { }
/**
* Provide the default form form for submitting options
* Provides the default form for submitting options.
*/
public function submitOptionsForm(&$form, FormStateInterface $form_state, &$options = array()) { }
/**
* Determine if the administrator has the privileges to use this plugin
* Determines if the administrator has the privileges to use this plugin.
*/
public function access() { return TRUE; }
/**
* If we don't have access to the form but are showing it anyway, ensure that
* the form is safe and cannot be changed from user input.
* Blocks user input when the form is shown but we don´t have access.
*
* This is only called by child objects if specified in the buildOptionsForm(),
* so it will not always be used.
@ -91,10 +89,13 @@ abstract class ArgumentValidatorPluginBase extends PluginBase {
}
}
/**
* Performs validation for a given argument.
*/
public function validateArgument($arg) { return TRUE; }
/**
* Process the summary arguments for displaying.
* Processes the summary arguments for displaying.
*
* Some plugins alter the argument so it uses something else internally.
* For example the user validation set's the argument to the uid,

View file

@ -320,7 +320,7 @@ class Block extends DisplayPluginBase {
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* * @see \Drupal\views\Plugin\Block\ViewsBlock::blockSubmit()
* @see \Drupal\views\Plugin\Block\ViewsBlock::blockSubmit()
*/
public function blockSubmit(ViewsBlock $block, $form, FormStateInterface $form_state) {
if ($items_per_page = $form_state->getValue(array('override', 'items_per_page'))) {

View file

@ -1524,7 +1524,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
);
$access = $this->getOption('access');
$form['access']['type'] = array(
$form['access']['type'] = array(
'#title' => $this->t('Access'),
'#title_display' => 'invisible',
'#type' => 'radios',
@ -1561,7 +1561,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
);
$cache = $this->getOption('cache');
$form['cache']['type'] = array(
$form['cache']['type'] = array(
'#title' => $this->t('Caching'),
'#title_display' => 'invisible',
'#type' => 'radios',
@ -1782,7 +1782,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
);
$exposed_form = $this->getOption('exposed_form');
$form['exposed_form']['type'] = array(
$form['exposed_form']['type'] = array(
'#title' => $this->t('Exposed form'),
'#title_display' => 'invisible',
'#type' => 'radios',
@ -1818,7 +1818,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
);
$pager = $this->getOption('pager');
$form['pager']['type'] = array(
$form['pager']['type'] = array(
'#title' => $this->t('Pager'),
'#title_display' => 'invisible',
'#type' => 'radios',
@ -2372,7 +2372,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
$build['#cache']['keys'][] = implode(',', $args);
}
$build['#cache_properties'] = ['#view_id', '#view_display_show_admin_links', '#view_display_plugin_id'];
$build['#cache_properties'] = ['#view_id', '#view_display_show_admin_links', '#view_display_plugin_id'];
return $build;

View file

@ -20,6 +20,13 @@ namespace Drupal\views\Plugin\views\display;
*/
class Embed extends DisplayPluginBase {
// This display plugin does nothing apart from exist.
/**
* {@inheritdoc}
*/
public function buildRenderable(array $args = [], $cache = TRUE) {
$build = parent::buildRenderable($args, $cache);
$build['#embed'] = TRUE;
return $build;
}
}

View file

@ -304,7 +304,7 @@ abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouter
$path = implode('/', $bits);
$view_id = $this->view->storage->id();
$display_id = $this->display['id'];
$view_id_display = "{$view_id}.{$display_id}";
$view_id_display = "{$view_id}.{$display_id}";
$menu_link_id = 'views.' . str_replace('/', '.', $view_id_display);
if ($path) {

View file

@ -116,8 +116,9 @@ interface FieldHandlerInterface extends ViewsHandlerInterface {
* @param \Drupal\views\ResultRow $values
* An object containing all retrieved values.
*
* @return \Drupal\Core\Entity\EntityInterface
* Returns the entity matching the values.
* @return \Drupal\Core\Entity\EntityInterface|null
* Returns the entity matching the values or NULL if there is no matching
* entity.
*/
public function getEntity(ResultRow $values);

View file

@ -45,4 +45,3 @@ interface MultiItemsFieldHandlerInterface extends FieldHandlerInterface {
public function renderItems($items);
}

View file

@ -80,7 +80,7 @@ class Combine extends StringFilter {
$separated_fields = array();
foreach ($fields as $key => $field) {
$separated_fields[] = $field;
if ($key < $count-1) {
if ($key < $count - 1) {
$separated_fields[] = "' '";
}
}

View file

@ -789,6 +789,17 @@ class Sql extends QueryPluginBase {
* ensuring that all fields are fully qualified (TABLE.FIELD) and that
* the table already exists in the query.
*
* The $field, $value and $operator arguments can also be passed in with a
* single DatabaseCondition object, like this:
* @code
* $this->query->addWhere(
* $this->options['group'],
* db_or()
* ->condition($field, $value, 'NOT IN')
* ->condition($field, $value, 'IS NULL')
* );
* @endcode
*
* @param $group
* The WHERE group to add these to; groups are used to create AND/OR
* sections. Groups cannot be nested. Use 0 as the default group.
@ -804,17 +815,6 @@ class Sql extends QueryPluginBase {
* complex options such as IN, LIKE, LIKE BINARY, or BETWEEN. Defaults to =.
* If $field is a string you have to use 'formula' here.
*
* The $field, $value and $operator arguments can also be passed in with a
* single DatabaseCondition object, like this:
* @code
* $this->query->addWhere(
* $this->options['group'],
* db_or()
* ->condition($field, $value, 'NOT IN')
* ->condition($field, $value, 'IS NULL')
* );
* @endcode
*
* @see \Drupal\Core\Database\Query\ConditionInterface::condition()
* @see \Drupal\Core\Database\Query\Condition
*/

View file

@ -678,6 +678,7 @@ abstract class StylePluginBase extends PluginBase {
$renderer = $this->getRenderer();
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache_plugin */
$cache_plugin = $this->view->display_handler->getPlugin('cache');
$max_age = $cache_plugin->getCacheMaxAge();
/** @var \Drupal\views\ResultRow $row */
foreach ($result as $index => $row) {
@ -698,6 +699,7 @@ abstract class StylePluginBase extends PluginBase {
'#cache' => [
'keys' => $cache_plugin->getRowCacheKeys($row),
'tags' => $cache_plugin->getRowCacheTags($row),
'max-age' => $max_age,
],
'#cache_properties' => $field_ids,
];

View file

@ -59,13 +59,13 @@ class FieldEntityTranslationTest extends ViewTestBase {
$node = Node::create([
'type' => 'article',
'title' => 'example EN',
'sticky' => false,
'sticky' => FALSE,
]);
$node->save();
$translation = $node->addTranslation('es');
$translation->title->value = 'example ES';
$translation->sticky->value = true;
$translation->sticky->value = TRUE;
$translation->save();
$this->drupalGet('test_entity_field_renderers/entity_translation');

View file

@ -2,6 +2,7 @@
namespace Drupal\views\Tests\Plugin;
use Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest as DisplayExtenderTestData;
use Drupal\views\Views;
/**
@ -38,7 +39,7 @@ class DisplayExtenderTest extends PluginTestBase {
$this->assertEqual(count($view->display_handler->getExtenders()), 1, 'Make sure that only one extender is initialized.');
$display_extender = $view->display_handler->getExtenders()['display_extender_test'];
$this->assertTrue($display_extender instanceof \Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest, 'Make sure the right class got initialized.');
$this->assertTrue($display_extender instanceof DisplayExtenderTestData, 'Make sure the right class got initialized.');
$view->preExecute();
$this->assertTrue($display_extender->testState['preExecute'], 'Make sure the display extender was able to react on preExecute.');

View file

@ -116,7 +116,7 @@ class ExposedFormTest extends ViewTestBase {
$identifier = 'bad identifier';
$view->displayHandlers->get('default')->overrideOption('filters', array(
'type' => [
'exposed' => TRUE,
'exposed' => TRUE,
'field' => 'type',
'id' => 'type',
'table' => 'node_field_data',

View file

@ -18,29 +18,10 @@ class ViewElementTest extends ViewTestBase {
*/
public static $testViews = array('test_view_embed');
/**
* The raw render data array to use in tests.
*
* @var array
*/
protected $render;
protected function setUp() {
parent::setUp();
$this->enableViewsTestModule();
// Set up a render array to use. We need to copy this as drupal_render
// passes by reference.
$this->render = array(
'view' => array(
'#type' => 'view',
'#name' => 'test_view_embed',
'#display_id' => 'default',
'#arguments' => array(25),
'#embed' => FALSE,
),
);
}
/**
@ -50,10 +31,11 @@ class ViewElementTest extends ViewTestBase {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container->get('renderer');
$view = Views::getView('test_view_embed');
$view->setDisplay();
// Set the content as our rendered array.
$render = $this->render;
// Get the render array, #embed must be FALSE since this is the default
// display.
$render = $view->buildRenderable();
$this->assertEqual($render['#embed'], FALSE);
$this->setRawContent($renderer->renderRoot($render));
$xpath = $this->xpath('//div[@class="views-element-container"]');
@ -98,7 +80,8 @@ class ViewElementTest extends ViewTestBase {
$view->save();
// Test the render array again.
$render = $this->render;
$view = Views::getView('test_view_embed');
$render = $view->buildRenderable(NULL, [25]);
$this->setRawContent($renderer->renderRoot($render));
// There should be 1 row in the results, 'John' arg 25.
$xpath = $this->xpath('//div[@class="view-content"]/div');
@ -118,11 +101,10 @@ class ViewElementTest extends ViewTestBase {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container->get('renderer');
$view = Views::getView('test_view_embed');
$view->setDisplay('embed_1');
// Set the content as our rendered array.
$render = $this->render;
$render['view']['#embed'] = TRUE;
// Get the render array, #embed must be TRUE since this is an embed display.
$render = $view->buildRenderable('embed_1');
$this->assertEqual($render['#embed'], TRUE);
$this->setRawContent($renderer->renderRoot($render));
$xpath = $this->xpath('//div[@class="views-element-container"]');
@ -167,8 +149,8 @@ class ViewElementTest extends ViewTestBase {
$view->save();
// Test the render array again.
$render = $this->render;
$render['view']['#embed'] = TRUE;
$view = Views::getView('test_view_embed');
$render = $view->buildRenderable('embed_1', [25]);
$this->setRawContent($renderer->renderRoot($render));
// There should be 1 row in the results, 'John' arg 25.
$xpath = $this->xpath('//div[@class="view-content"]/div');
@ -180,9 +162,8 @@ class ViewElementTest extends ViewTestBase {
$this->assertEqual(count($xpath), 1);
// Tests the render array with an exposed filter.
$render = $this->render;
$render['view']['#display_id'] = 'embed_2';
$render['view']['#embed'] = TRUE;
$view = Views::getView('test_view_embed');
$render = $view->buildRenderable('embed_2');
$this->setRawContent($renderer->renderRoot($render));
// Ensure that the exposed form is rendered.

View file

@ -2062,7 +2062,7 @@ class ViewExecutable implements \Serializable {
$result = $this->displayHandlers->get($id)->validate();
if (!empty($result) && is_array($result)) {
$errors[$id] = $result;
$errors[$id] = $result;
}
}
}

View file

@ -190,4 +190,3 @@ class ViewsDataHelper {
}
}

View file

@ -5,12 +5,15 @@
* Text fixture.
*/
$connection = Drupal\Core\Database\Database::getConnection();
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
$connection->insert('config')
->fields(array(
'collection' => '',
'name' => 'views.view.test_token_view',
'data' => serialize(\Drupal\Component\Serialization\Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.test_token_view.yml'))),
'data' => serialize(Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.test_token_view.yml'))),
))
->execute();

View file

@ -5,12 +5,15 @@
* Test fixture.
*/
$connection = Drupal\Core\Database\Database::getConnection();
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
$connection->insert('config')
->fields(array(
'collection' => '',
'name' => 'views.view.test_duplicate_field_handlers',
'data' => serialize(\Drupal\Component\Serialization\Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.test_duplicate_field_handlers.yml'))),
'data' => serialize(Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.test_duplicate_field_handlers.yml'))),
))
->execute();

View file

@ -0,0 +1,503 @@
langcode: en
status: true
dependencies:
config:
- system.menu.tools
module:
- node
id: test_row_render_cache_none
label: 'Test no render cache'
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: nid
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: none
options: { }
cache:
type: none
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: full
options:
items_per_page: 10
offset: 0
id: 0
total_pages: null
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
tags:
previous: ' Previous'
next: 'Next '
first: '« First'
last: 'Last »'
quantity: 9
style:
type: table
options:
grouping: { }
row_class: ''
default_row_class: true
override: true
sticky: false
caption: ''
summary: ''
description: ''
columns:
counter: counter
title: title
edit_node: edit_node
delete_node: delete_node
operations: operations
info:
counter:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
title:
sortable: true
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
edit_node:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
delete_node:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
operations:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
default: '-1'
empty_table: false
row:
type: fields
options:
inline: { }
separator: ''
hide_empty: false
default_field_elements: true
fields:
nid:
id: nid
table: node_field_data
field: nid
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: true
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: number_integer
settings:
thousand_separator: ''
prefix_suffix: true
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: node
entity_field: nid
plugin_id: field
counter:
id: counter
table: views
field: counter
relationship: none
group_type: group
admin_label: ''
label: Index
exclude: false
alter:
alter_text: true
text: '{{ nid }}: {{ counter }} (just in case: {{ nid }})'
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
counter_start: 1
plugin_id: counter
title:
id: title
table: node_field_data
field: title
relationship: none
group_type: group
admin_label: ''
label: Title
exclude: false
alter:
alter_text: true
text: '<span class="da-title">{{ title }}</span> <span class="counter">{{ counter }}</span>'
make_link: true
path: 'node/{{ nid }}'
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: false
ellipsis: false
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: false
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: node
entity_field: title
plugin_id: field
edit_node:
id: edit_node
table: node
field: edit_node
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
text: ''
entity_type: node
plugin_id: entity_link_edit
delete_node:
id: delete_node
table: node
field: delete_node
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
text: ''
entity_type: node
plugin_id: entity_link_delete
operations:
id: operations
table: node
field: operations
relationship: none
group_type: group
admin_label: ''
label: Operations
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
destination: true
entity_type: node
plugin_id: entity_operations
filters:
status:
value: true
table: node_field_data
field: status
plugin_id: boolean
entity_type: node
entity_field: status
id: status
expose:
operator: ''
group: 1
sorts:
title:
id: title
table: node_field_data
field: title
relationship: none
group_type: group
admin_label: ''
order: ASC
exposed: false
expose:
label: ''
entity_type: node
entity_field: title
plugin_id: standard
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
cache_metadata:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- 'user.node_grants:view'
max-age: 0

View file

@ -5,6 +5,8 @@
* Helper module for Views tests.
*/
use Drupal\Core\Form\FormStateInterface;
/**
* Access callback for the generic handler test.
*
@ -126,6 +128,6 @@ function views_test_data_test_pre_render_function($element) {
/**
* Implements hook_form_BASE_FORM_ID_alter().
*/
function views_test_data_form_views_form_test_form_multiple_default_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
function views_test_data_form_views_form_test_form_multiple_default_alter(&$form, FormStateInterface $form_state, $form_id) {
drupal_set_message(t('Test base form ID with Views forms and arguments.'));
}

View file

@ -163,7 +163,7 @@ class FieldFieldTest extends ViewsKernelTestBase {
'name' => 'base value',
'field_test' => 1,
'field_test_multiple' => [1, 3, 7],
'user_id' => $this->testUsers[0]->id(),
'user_id' => $this->testUsers[0]->id(),
]);
$entity->save();
$original_entity = clone $entity;

View file

@ -215,4 +215,3 @@ class FilterBooleanOperatorTest extends ViewsKernelTestBase {
}
}

View file

@ -115,6 +115,8 @@ class ModuleTest extends ViewsKernelTestBase {
/**
* Defines an error handler which is used in the test.
*
* Because this is registered in set_error_handler(), it has to be public.
*
* @param int $error_level
* The level of the error raised.
* @param string $message
@ -127,7 +129,6 @@ class ModuleTest extends ViewsKernelTestBase {
* An array that points to the active symbol table at the point the error
* occurred.
*
* Because this is registered in set_error_handler(), it has to be public.
* @see set_error_handler()
*/
public function customErrorHandler($error_level, $message, $filename, $line, $context) {
@ -229,7 +230,7 @@ class ModuleTest extends ViewsKernelTestBase {
$plugins = Views::fetchPluginNames('style');
$definitions = $this->container->get('plugin.manager.views.style')->getDefinitions();
$expected = array();
foreach ($definitions as $id =>$definition) {
foreach ($definitions as $id => $definition) {
$expected[$id] = $definition['title'];
}
asort($expected);

View file

@ -31,7 +31,7 @@ class RowRenderCacheTest extends ViewsKernelTestBase {
*
* @var array
*/
public static $testViews = array('test_row_render_cache');
public static $testViews = array('test_row_render_cache', 'test_row_render_cache_none');
/**
* An editor user account.
@ -103,6 +103,34 @@ class RowRenderCacheTest extends ViewsKernelTestBase {
$this->doTestRenderedOutput($this->editorUser);
}
/**
* Test that rows are not cached when the none cache plugin is used.
*/
public function testNoCaching() {
$this->setCurrentUser($this->regularUser);
$view = Views::getView('test_row_render_cache_none');
$view->setDisplay();
$view->preview();
/** @var \Drupal\Core\Render\RenderCacheInterface $render_cache */
$render_cache = $this->container->get('render_cache');
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache_plugin */
$cache_plugin = $view->display_handler->getPlugin('cache');
foreach ($view->result as $row) {
$keys = $cache_plugin->getRowCacheKeys($row);
$cache = [
'#cache' => [
'keys' => $keys,
'contexts' => ['languages:language_interface', 'theme', 'user.permissions'],
],
];
$element = $render_cache->get($cache);
$this->assertFalse($element);
}
}
/**
* Check whether the rendered output matches expectations.
*
@ -161,7 +189,13 @@ class RowRenderCacheTest extends ViewsKernelTestBase {
if ($check_cache) {
$keys = $cache_plugin->getRowCacheKeys($view->result[$index]);
$user_context = !$account->hasPermission('edit any test content') ? 'user' : 'user.permissions';
$element = $render_cache->get(['#cache' => ['keys' => $keys, 'contexts' => ['languages:language_interface', 'theme', $user_context]]]);
$cache = [
'#cache' => [
'keys' => $keys,
'contexts' => ['languages:language_interface', 'theme', $user_context],
],
];
$element = $render_cache->get($cache);
$this->assertTrue($element);
}

View file

@ -94,7 +94,7 @@ class RenderCacheIntegrationTest extends ViewsKernelTestBase {
// Empty result (no entities yet).
$this->pass('Test without entities');
$base_tags = ['config:views.view.entity_test_fields', 'entity_test_list'];
$base_tags = ['config:views.view.entity_test_fields', 'entity_test_list'];
$this->assertViewsCacheTags($view, $base_tags, $do_assert_views_caches, $base_tags);
$this->assertViewsCacheTagsFromStaticRenderArray($view, $base_tags, $do_assert_views_caches);

View file

@ -1,12 +1,12 @@
<?php
namespace Drupal\views\Tests;
namespace Drupal\Tests\views\Kernel;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\config_test\TestInstallStorage;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\TypedConfigManager;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests that test views provided by all modules match schema.

View file

@ -422,7 +422,7 @@ class ViewExecutableTest extends ViewsKernelTestBase {
$count = 0;
foreach ($view->displayHandlers as $id => $display) {
$match = function($value) use ($display) {
return strpos($value, $display->display['display_title']) !== false;
return strpos($value, $display->display['display_title']) !== FALSE;
};
$this->assertTrue(array_filter($validate[$id], $match), format_string('Error message found for @id display', array('@id' => $id)));
$count++;

View file

@ -71,4 +71,3 @@ class WizardPluginBaseKernelTest extends ViewsKernelTestBase {
$this->assertEqual($view->get('langcode'), 'it');
}
}

View file

@ -360,4 +360,3 @@ class ViewAjaxControllerTest extends UnitTestCase {
}
}

View file

@ -214,7 +214,7 @@ class EntityTest extends UnitTestCase {
$options['bundles'] = array('test_bundle' => 1);
$argumentValidator->init($this->executable, $this->display, $options);
$this->assertEquals(['config'=>['test_bundle']], $argumentValidator->calculateDependencies());
$this->assertEquals(['config' => ['test_bundle']], $argumentValidator->calculateDependencies());
}
/**

View file

@ -395,46 +395,46 @@ class FieldPluginBaseTest extends UnitTestCase {
// Simple path with default options.
$url = Url::fromRoute('test_route');
$data[]= [$url, [], clone $url, '/test-path', clone $url, '<a href="/test-path">value</a>'];
$data[] = [$url, [], clone $url, '/test-path', clone $url, '<a href="/test-path">value</a>'];
// Simple url with parameters.
$url_parameters = Url::fromRoute('test_route', ['key' => 'value']);
$data[]= [$url_parameters, [], clone $url_parameters, '/test-path/value', clone $url_parameters, '<a href="/test-path/value">value</a>'];
$data[] = [$url_parameters, [], clone $url_parameters, '/test-path/value', clone $url_parameters, '<a href="/test-path/value">value</a>'];
// Add a fragment.
$url = Url::fromRoute('test_route');
$url_with_fragment = Url::fromRoute('test_route');
$options = ['fragment' => 'test'] + $this->defaultUrlOptions;
$url_with_fragment->setOptions($options);
$data[]= [$url, ['fragment' => 'test'], $url_with_fragment, '/test-path#test', clone $url_with_fragment, '<a href="/test-path#test">value</a>'];
$data[] = [$url, ['fragment' => 'test'], $url_with_fragment, '/test-path#test', clone $url_with_fragment, '<a href="/test-path#test">value</a>'];
// Rel attributes.
$url = Url::fromRoute('test_route');
$url_with_rel = Url::fromRoute('test_route');
$options = ['attributes' => ['rel' => 'up']] + $this->defaultUrlOptions;
$url_with_rel->setOptions($options);
$data[]= [$url, ['rel' => 'up'], clone $url, '/test-path', $url_with_rel, '<a href="/test-path" rel="up">value</a>'];
$data[] = [$url, ['rel' => 'up'], clone $url, '/test-path', $url_with_rel, '<a href="/test-path" rel="up">value</a>'];
// Target attributes.
$url = Url::fromRoute('test_route');
$url_with_target = Url::fromRoute('test_route');
$options = ['attributes' => ['target' => '_blank']] + $this->defaultUrlOptions;
$url_with_target->setOptions($options);
$data[]= [$url, ['target' => '_blank'], $url_with_target, '/test-path', clone $url_with_target, '<a href="/test-path" target="_blank">value</a>'];
$data[] = [$url, ['target' => '_blank'], $url_with_target, '/test-path', clone $url_with_target, '<a href="/test-path" target="_blank">value</a>'];
// Link attributes.
$url = Url::fromRoute('test_route');
$url_with_link_attributes = Url::fromRoute('test_route');
$options = ['attributes' => ['foo' => 'bar']] + $this->defaultUrlOptions;
$url_with_link_attributes->setOptions($options);
$data[]= [$url, ['link_attributes' => ['foo' => 'bar']], clone $url, '/test-path', $url_with_link_attributes, '<a href="/test-path" foo="bar">value</a>'];
$data[] = [$url, ['link_attributes' => ['foo' => 'bar']], clone $url, '/test-path', $url_with_link_attributes, '<a href="/test-path" foo="bar">value</a>'];
// Manual specified query.
$url = Url::fromRoute('test_route');
$url_with_query = Url::fromRoute('test_route');
$options = ['query' => ['foo' => 'bar']] + $this->defaultUrlOptions;
$url_with_query->setOptions($options);
$data[]= [$url, ['query' => ['foo' => 'bar']], clone $url_with_query, '/test-path?foo=bar', $url_with_query, '<a href="/test-path?foo=bar">value</a>'];
$data[] = [$url, ['query' => ['foo' => 'bar']], clone $url_with_query, '/test-path?foo=bar', $url_with_query, '<a href="/test-path?foo=bar">value</a>'];
// Query specified as part of the path.
$url = Url::fromRoute('test_route')->setOption('query', ['foo' => 'bar']);
@ -510,7 +510,7 @@ class FieldPluginBaseTest extends UnitTestCase {
$field->field_alias = 'key';
$row = new ResultRow(['key' => 'value']);
$build =[
$build = [
'#type' => 'inline_template',
'#template' => 'test-path/' . explode('/', $path)[1],
'#context' => ['foo' => 123],

View file

@ -161,7 +161,7 @@ class ViewsDataTest extends UnitTestCase {
$this->assertCount(6, $base_tables, 'The correct amount of base tables were returned.');
$base_tables_keys = array_keys($base_tables);
for ($i = 1; $i < count($base_tables); ++$i) {
$prev = $base_tables[$base_tables_keys[$i - 1]];
$prev = $base_tables[$base_tables_keys[$i - 1]];
$current = $base_tables[$base_tables_keys[$i]];
$this->assertTrue($prev['weight'] <= $current['weight'] && $prev['title'] <= $prev['title'], 'The tables are sorted as expected.');
}

View file

@ -29,7 +29,7 @@ function views_help($route_name, RouteMatchInterface $route_match) {
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Views module provides a back end to fetch information from content, user accounts, taxonomy terms, and other entities from the database and present it to the user as a grid, HTML list, table, unformatted list, etc. The resulting displays are known generally as <em>views</em>.') . '</p>';
$output .= '<p>' . t('For more information, see the <a href=":views">online documentation for the Views module</a>.', array(':views' => 'https://www.drupal.org/documentation/modules/views')) . '</p>';
$output .= '<p>' . t('In order to create and modify your own views using the administration and configuration user interface, you will need to enable either the Views UI module in core or a contributed module that provides a user interface for Views. See the <a href=":views-ui">Views UI module help page</a> for more information.', array(':views-ui' => (\Drupal::moduleHandler()->moduleExists('views_ui')) ? \Drupal::url('help.page', array('name' => 'views_ui')) : '#')) . '</p>';
$output .= '<p>' . t('In order to create and modify your own views using the administration and configuration user interface, you will need to enable either the Views UI module in core or a contributed module that provides a user interface for Views. See the <a href=":views-ui">Views UI module help page</a> for more information.', array(':views-ui' => (\Drupal::moduleHandler()->moduleExists('views_ui')) ? \Drupal::url('help.page', array('name' => 'views_ui')) : '#')) . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Adding functionality to administrative pages') . '</dt>';

View file

@ -159,3 +159,26 @@ function views_post_update_field_formatter_dependencies() {
/**
* @} End of "addtogroup updates-8.0.x".
*/
/**
* @addtogroup updates-8.1.x
* @{
*/
/**
* Fix views with dependencies on taxonomy terms that don't exist.
*/
function views_post_update_taxonomy_index_tid() {
$views = View::loadMultiple();
array_walk($views, function(View $view) {
$old_dependencies = $view->getDependencies();
$new_dependencies = $view->calculateDependencies()->getDependencies();
if ($old_dependencies !== $new_dependencies) {
$view->save();
}
});
}
/**
* @} End of "addtogroup updates-8.1.x".
*/

View file

@ -426,7 +426,7 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora
'group' => $group,
'title' => $label,
'title short' => $label,
'help' => t('Appears in: @bundles.', array('@bundles' => implode(', ', $bundles_names))),
'help' => t('Appears in: @bundles.', array('@bundles' => implode(', ', $bundles_names))),
);
// Go through and create a list of aliases for all possible combinations of
@ -545,7 +545,7 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora
'group' => $group,
'title' => $title,
'title short' => $title_short,
'help' => t('Appears in: @bundles.', array('@bundles' => implode(', ', $bundles_names))),
'help' => t('Appears in: @bundles.', array('@bundles' => implode(', ', $bundles_names))),
);
// Go through and create a list of aliases for all possible combinations of
@ -702,7 +702,7 @@ function core_field_views_data(FieldStorageConfigInterface $field_storage) {
'title' => t('@label referenced from @field_name', $args),
'label' => t('@field_name: @label', $args),
'group' => $entity_type->getLabel(),
'help' => t('Appears in: @bundles.', array('@bundles' => implode(', ', $field_storage->getBundles()))),
'help' => t('Appears in: @bundles.', array('@bundles' => implode(', ', $field_storage->getBundles()))),
'id' => 'standard',
'base' => $target_base_table,
'entity type' => $target_entity_type_id,