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

@ -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

@ -0,0 +1,56 @@
<?php
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\KernelTests\KernelTestBase;
/**
* Tests that test views provided by all modules match schema.
*
* @group config
*/
class TestViewsTest extends KernelTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('views_test_data');
/**
* Tests default configuration data type.
*/
public function testDefaultConfig() {
// Create a typed config manager with access to configuration schema in
// every module, profile and theme.
$typed_config = new TypedConfigManager(
\Drupal::service('config.storage'),
new TestInstallStorage(InstallStorage::CONFIG_SCHEMA_DIRECTORY),
\Drupal::service('cache.discovery'),
\Drupal::service('module_handler')
);
// Create a configuration storage with access to default configuration in
// every module, profile and theme.
$default_config_storage = new TestInstallStorage('test_views');
foreach ($default_config_storage->listAll() as $config_name) {
// Skip files provided by the config_schema_test module since that module
// is explicitly for testing schema.
if (strpos($config_name, 'config_schema_test') === 0) {
continue;
}
$data = $default_config_storage->read($config_name);
$this->assertConfigSchema($typed_config, $config_name, $data);
}
}
}

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.');
}