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

This commit is contained in:
Pantheon Automation 2016-03-02 12:40:24 -08:00 committed by Greg Anderson
parent 2a9f1f148d
commit fd3b12cf27
251 changed files with 5439 additions and 957 deletions

View file

@ -0,0 +1,225 @@
langcode: en
status: true
dependencies:
config:
- node.type.page
module:
- node
- user
id: test_argument_default_node
label: 'Test argument_default node'
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: perm
options:
perm: 'access content'
cache:
type: tag
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: none
options:
items_per_page: null
offset: 0
style:
type: default
row:
type: fields
fields:
title:
id: title
table: node_field_data
field: title
settings:
link_to_entity: true
plugin_id: field
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: 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
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
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
type:
id: type
table: node_field_data
field: type
value:
page: page
entity_type: node
entity_field: type
plugin_id: bundle
sorts:
title:
id: title
table: node_field_data
field: title
order: DESC
entity_type: node
entity_field: title
plugin_id: standard
relationship: none
group_type: group
admin_label: ''
exposed: false
expose:
label: ''
title: 'Test argument_default node'
header: { }
footer: { }
empty: { }
relationships: { }
arguments:
nid:
id: nid
table: node_field_data
field: nid
relationship: none
group_type: group
admin_label: ''
default_action: default
exception:
value: all
title_enable: false
title: All
title_enable: false
title: ''
default_argument_type: node
default_argument_options: { }
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
items_per_page: 25
override: false
summary:
sort_order: asc
number_of_records: 0
format: default_summary
specify_validation: false
validate:
type: none
fail: 'not found'
validate_options: { }
break_phrase: false
not: false
entity_type: node
entity_field: nid
plugin_id: node_nid
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- 'user.node_grants:view'
- user.permissions
tags: { }
block_1:
display_plugin: block
id: block_1
display_title: Block
position: 1
display_options:
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- 'user.node_grants:view'
- user.permissions
tags: { }

View file

@ -0,0 +1,229 @@
langcode: en
status: true
dependencies:
module:
- node
- user
id: test_argument_validation
label: ''
module: views
description: 'This view is used to test the argument validator schema.'
tag: ''
base_table: views_test_data
base_field: ''
core: '8'
display:
default:
display_options:
defaults:
fields: false
pager: false
sorts: false
arguments: false
fields:
age:
field: age
id: age
relationship: none
table: views_test_data
id:
field: id
id: id
relationship: none
table: views_test_data
name:
field: name
id: name
relationship: none
table: views_test_data
pager:
options:
offset: 0
type: none
sorts:
id:
field: id
id: id
order: ASC
relationship: none
table: views_test_data
arguments:
id:
id: id
table: views_test_data
field: id
relationship: none
group_type: group
admin_label: ''
default_action: ignore
exception:
value: all
title_enable: false
title: All
title_enable: false
title: ''
default_argument_type: fixed
default_argument_options:
argument: ''
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
items_per_page: 25
override: false
summary:
sort_order: asc
number_of_records: 0
format: default_summary
specify_validation: false
validate:
type: numeric
fail: 'not found'
validate_options: { }
break_phrase: true
not: false
entity_type: node
entity_field: nid
plugin_id: numeric
name:
id: title
table: views_test_data
field: name
relationship: none
group_type: group
admin_label: ''
default_action: ignore
exception:
value: all
title_enable: false
title: All
title_enable: false
title: ''
default_argument_type: fixed
default_argument_options:
argument: ''
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
items_per_page: 25
override: false
summary:
sort_order: asc
number_of_records: 0
format: default_summary
specify_validation: false
validate:
type: none
fail: 'not found'
validate_options: { }
glossary: false
limit: 0
case: none
path_case: none
transform_dash: false
break_phrase: true
entity_type: node
entity_field: name
plugin_id: string
user:
id: user
table: node_field_data
field: uid
relationship: none
group_type: group
admin_label: ''
default_action: ignore
exception:
value: all
title_enable: false
title: All
title_enable: false
title: ''
default_argument_type: fixed
default_argument_options:
argument: ''
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
items_per_page: 25
override: false
summary:
sort_order: asc
number_of_records: 0
format: default_summary
specify_validation: false
validate:
type: 'entity:user'
fail: 'access denied'
validate_options:
access: true
operation: view
multiple: 0
restrict_roles: true
roles:
authenticated: authenticated
administrator: administrator
glossary: false
limit: 0
case: none
path_case: none
transform_dash: false
break_phrase: true
entity_type: node
entity_field: name
plugin_id: numeric
nid:
id: nid
table: node_field_data
field: nid
relationship: none
group_type: group
admin_label: ''
default_action: default
exception:
value: all
title_enable: false
title: All
title_enable: false
title: ''
default_argument_type: node
default_argument_options: { }
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
items_per_page: 25
override: false
summary:
sort_order: asc
number_of_records: 0
format: default_summary
specify_validation: false
validate:
type: 'entity:node'
fail: 'not found'
validate_options:
bundles:
article: article
page: page
access: true
operation: view
multiple: 0
break_phrase: false
not: false
entity_type: node
entity_field: nid
plugin_id: node_nid
display_extenders: { }
display_plugin: default
display_title: Master
id: default
position: 0
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url
tags: { }

View file

@ -0,0 +1,281 @@
langcode: en
status: true
dependencies:
module:
- node
- user
id: test_exposed_relationship_admin_ui
label: test_exposed_relationship_admin_ui
module: views
description: ''
tag: ''
base_table: node
base_field: nid
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: perm
options:
perm: 'access content'
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: default
options:
grouping: { }
row_class: ''
default_row_class: true
uses_fields: false
row:
type: fields
options:
inline: { }
separator: ''
hide_empty: false
default_field_elements: true
fields:
title:
id: title
table: node_field_data
field: title
entity_type: node
entity_field: title
label: ''
alter:
alter_text: false
make_link: false
absolute: false
trim: false
word_boundary: false
ellipsis: false
strip_tags: false
html: false
hide_empty: false
empty_zero: false
link_to_node: true
plugin_id: node
relationship: none
group_type: group
admin_label: ''
exclude: 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_alter_empty: true
login:
id: login
table: users_field_data
field: login
relationship: uid
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
date_format: fallback
custom_date_format: ''
timezone: ''
entity_type: user
entity_field: login
plugin_id: date
created:
id: created
table: users_field_data
field: created
relationship: uid
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
date_format: fallback
custom_date_format: ''
timezone: ''
entity_type: user
entity_field: created
plugin_id: date
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:
created:
id: created
table: node_field_data
field: created
order: DESC
entity_type: node
entity_field: created
plugin_id: date
relationship: none
group_type: group
admin_label: ''
exposed: false
expose:
label: ''
granularity: second
header: { }
footer: { }
empty: { }
relationships:
uid:
id: uid
table: node_field_data
field: uid
relationship: none
group_type: group
admin_label: author
required: false
entity_type: node
entity_field: uid
plugin_id: standard
uid_1:
id: uid_1
table: node_field_data
field: uid
relationship: none
group_type: group
admin_label: 'author 2'
required: false
entity_type: node
entity_field: uid
plugin_id: standard
arguments: { }
display_extenders: { }

View file

@ -282,16 +282,21 @@ class EntityViewsDataTest extends UnitTestCase {
// Ensure the join information is set up properly.
// Tests the join definition between the base and the revision table.
$revision_data = $data['entity_test_mulrev_property_revision'];
$this->assertCount(2, $revision_data['table']['join']);
$revision_field_data = $data['entity_test_mulrev_property_revision'];
$this->assertCount(1, $revision_field_data['table']['join']);
$this->assertEquals([
'entity_test_mul_property_data' => [
'left_field' => 'revision_id', 'field' => 'revision_id', 'type' => 'INNER'
],
'entity_test_mulrev_revision' => [
], $revision_field_data['table']['join']);
$revision_base_data = $data['entity_test_mulrev_revision'];
$this->assertCount(1, $revision_base_data['table']['join']);
$this->assertEquals([
'entity_test_mulrev_property_revision' => [
'left_field' => 'revision_id', 'field' => 'revision_id', 'type' => 'INNER'
],
], $revision_data['table']['join']);
], $revision_base_data['table']['join']);
$this->assertFalse(isset($data['data_table']));
}
@ -321,12 +326,21 @@ class EntityViewsDataTest extends UnitTestCase {
// Ensure the join information is set up properly.
// Tests the join definition between the base and the revision table.
$revision_data = $data['entity_test_mulrev_property_revision'];
$this->assertCount(2, $revision_data['table']['join']);
$revision_field_data = $data['entity_test_mulrev_property_revision'];
$this->assertCount(1, $revision_field_data['table']['join']);
$this->assertEquals([
'entity_test_mulrev_field_data' => ['left_field' => 'revision_id', 'field' => 'revision_id', 'type' => 'INNER'],
'entity_test_mulrev_revision' => ['left_field' => 'revision_id', 'field' => 'revision_id', 'type' => 'INNER'],
], $revision_data['table']['join']);
'entity_test_mulrev_field_data' => [
'left_field' => 'revision_id', 'field' => 'revision_id', 'type' => 'INNER'
],
], $revision_field_data['table']['join']);
$revision_base_data = $data['entity_test_mulrev_revision'];
$this->assertCount(1, $revision_base_data['table']['join']);
$this->assertEquals([
'entity_test_mulrev_property_revision' => [
'left_field' => 'revision_id', 'field' => 'revision_id', 'type' => 'INNER'
],
], $revision_base_data['table']['join']);
$this->assertFalse(isset($data['data_table']));
}

View file

@ -343,6 +343,8 @@ class FieldPluginBaseTest extends UnitTestCase {
// External URL.
$data[] = ['https://www.drupal.org', [], [], '<a href="https://www.drupal.org">value</a>'];
$data[] = ['www.drupal.org', ['external' => TRUE], [], '<a href="http://www.drupal.org">value</a>'];
$data[] = ['', ['external' => TRUE], [], 'value'];
return $data;
}
@ -510,7 +512,7 @@ class FieldPluginBaseTest extends UnitTestCase {
$build =[
'#type' => 'inline_template',
'#template' => 'base:test-path/' . explode('/', $path)[1],
'#template' => 'test-path/' . explode('/', $path)[1],
'#context' => ['foo' => 123],
'#post_render' => [function() {}],
];
@ -549,6 +551,62 @@ class FieldPluginBaseTest extends UnitTestCase {
return $data;
}
/**
* Test rendering of a link with a path and options.
*
* @dataProvider providerTestRenderAsExternalLinkWithPathAndTokens
* @covers ::renderAsLink
*/
public function testRenderAsExternalLinkWithPathAndTokens($path, $tokens, $link_html, $context) {
$alter = [
'make_link' => TRUE,
'path' => $path,
'url' => '',
];
if (isset($context['alter'])) {
$alter += $context['alter'];
}
$this->setUpUrlIntegrationServices();
$this->setupDisplayWithEmptyArgumentsAndFields();
$this->executable->build_info['substitutions'] = $tokens;
$field = $this->setupTestField(['alter' => $alter]);
$field->field_alias = 'key';
$row = new ResultRow(['key' => 'value']);
$build = [
'#type' => 'inline_template',
'#template' => $path,
'#context' => ['foo' => $context['context_path']],
'#post_render' => [function() {}],
];
$this->renderer->expects($this->once())
->method('renderPlain')
->with($build)
->willReturn($context['context_path']);
$result = $field->advancedRender($row);
$this->assertEquals($link_html, $result);
}
/**
* Data provider for ::testRenderAsExternalLinkWithPathAndTokens().
*
* @return array
* Test data.
*/
public function providerTestRenderAsExternalLinkWithPathAndTokens() {
$data = [];
$data[] = ['{{ foo }}', ['{{ foo }}' => 'http://www.drupal.org'], '<a href="http://www.drupal.org">value</a>', ['context_path' => 'http://www.drupal.org']];
$data[] = ['{{ foo }}', ['{{ foo }}' => ''], 'value', ['context_path' => '']];
$data[] = ['{{ foo }}', ['{{ foo }}' => ''], 'value', ['context_path' => '', 'alter' => ['external' => TRUE]]];
$data[] = ['{{ foo }}', ['{{ foo }}' => '/test-path/123'], '<a href="/test-path/123">value</a>', ['context_path' => '/test-path/123']];
return $data;
}
/**
* Sets up a test field.
*

View file

@ -7,10 +7,16 @@
namespace Drupal\Tests\views\Unit;
use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Url;
use Drupal\Tests\UnitTestCase;
use Drupal\views\Entity\View;
use Drupal\views\Plugin\views\cache\CachePluginBase;
use Drupal\views\Plugin\views\cache\None as NoneCache;
use Drupal\views\Plugin\views\pager\None as NonePager;
use Drupal\views\Plugin\views\query\QueryPluginBase;
use Drupal\views\ViewExecutable;
use Symfony\Component\Routing\Route;
@ -76,6 +82,20 @@ class ViewExecutableTest extends UnitTestCase {
*/
protected $routeProvider;
/**
* The mocked none cache plugin.
*
* @var \Drupal\views\Plugin\views\cache\None|\PHPUnit_Framework_MockObject_MockObject
*/
protected $noneCache;
/**
* The mocked cache plugin that returns a successful result.
*
* @var \Drupal\views\Plugin\views\cache\None|\PHPUnit_Framework_MockObject_MockObject
*/
protected $successCache;
/**
* {@inheritdoc}
*/
@ -103,10 +123,26 @@ class ViewExecutableTest extends UnitTestCase {
->disableOriginalConstructor()
->getMock();
$module_handler = $this->getMockBuilder(ModuleHandlerInterface::class)
->getMock();
$this->noneCache = $this->getMockBuilder(NoneCache::class)
->disableOriginalConstructor()
->getMock();
$success_cache = $this->prophesize(CachePluginBase::class);
$success_cache->cacheGet('results')->willReturn(TRUE);
$this->successCache = $success_cache->reveal();
$cache_manager = $this->prophesize(PluginManagerInterface::class);
$cache_manager->createInstance('none')->willReturn($this->noneCache);
$translation = $this->getStringTranslationStub();
$container = new ContainerBuilder();
$container->set('string_translation', $translation);
$container->set('views.executable', $this->viewExecutableFactory);
$container->set('module_handler', $module_handler);
$container->set('plugin.manager.views.cache', $cache_manager->reveal());
\Drupal::setContainer($container);
}
@ -452,6 +488,11 @@ class ViewExecutableTest extends UnitTestCase {
$display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
->disableOriginalConstructor()
->getMock();
$display->expects($this->any())
->method('getPlugin')
->with($this->equalTo('cache'))
->willReturn($this->successCache);
$display->display = $config['display']['default'];
$view->current_display = 'default';
@ -466,6 +507,10 @@ class ViewExecutableTest extends UnitTestCase {
->with('default')
->willReturn(TRUE);
foreach (array_keys($view->getHandlerTypes()) as $type) {
$view->$type = [];
}
return array($view, $display);
}
@ -565,4 +610,31 @@ class ViewExecutableTest extends UnitTestCase {
$this->assertNotContains('page:12', $view->element['#cache']['keys']);
}
/**
* @covers ::execute
*/
public function testCacheIsIgnoredDuringPreview() {
/** @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject $view */
/** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit_Framework_MockObject_MockObject $display */
list($view, $display) = $this->setupBaseViewAndDisplay();
// Pager needs to be set to avoid false test failures.
$view->pager = $this->getMockBuilder(NonePager::class)
->disableOriginalConstructor()
->getMock();
$query = $this->getMockBuilder(QueryPluginBase::class)
->disableOriginalConstructor()
->getMock();
$view->query = $query;
$view->built = TRUE;
$view->live_preview = TRUE;
$this->noneCache->expects($this->once())->method('cacheGet');
$query->expects($this->once())->method('execute');
$view->execute();
}
}