updated core from 8.4 to 8.5 : bug with login_destination

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-13 14:01:21 +01:00
parent 0d78da249b
commit e668535a4e
3486 changed files with 89604 additions and 33283 deletions
@@ -0,0 +1,19 @@
<?php
/**
* @file
* Test fixture.
*/
use Drupal\Core\Database\Database;
use Drupal\Core\Serialization\Yaml;
$connection = Database::getConnection();
$connection->insert('config')
->fields([
'collection' => '',
'name' => 'views.view.node_link_update_test',
'data' => serialize(Yaml::decode(file_get_contents('core/modules/views/tests/fixtures/update/views.view.node_link_update_test.yml'))),
])
->execute();
@@ -0,0 +1,19 @@
<?php
/**
* @file
* Test fixture.
*/
use Drupal\Core\Database\Database;
use Drupal\Core\Serialization\Yaml;
$connection = Database::getConnection();
$connection->insert('config')
->fields([
'collection' => '',
'name' => 'views.view.placeholder_text_test',
'data' => serialize(Yaml::decode(file_get_contents('core/modules/views/tests/fixtures/update/views.view.placeholder_text_test.yml'))),
])
->execute();
@@ -0,0 +1,19 @@
<?php
/**
* @file
* Test fixture.
*/
use Drupal\Core\Database\Database;
use Drupal\Core\Serialization\Yaml;
$connection = Database::getConnection();
$connection->insert('config')
->fields([
'collection' => '',
'name' => 'views.view.legacy_bulk_form',
'data' => serialize(Yaml::decode(file_get_contents(__DIR__ . '/views.view.legacy_bulk_form.yml'))),
])
->execute();
@@ -0,0 +1,19 @@
<?php
/**
* @file
* Test fixture.
*/
use Drupal\Core\Database\Database;
use Drupal\Core\Serialization\Yaml;
$connection = Database::getConnection();
$connection->insert('config')
->fields([
'collection' => '',
'name' => 'views.view.test_table_max_age',
'data' => serialize(Yaml::decode(file_get_contents('core/modules/views/tests/fixtures/update/views.view.test_table_max_age.yml'))),
])
->execute();
@@ -0,0 +1,71 @@
<?php
/**
* @file
* Contains database additions to drupal-8.bare.standard.php.gz for testing
* views_post_update_views_data_table_dependencies().
*/
use Drupal\Core\Database\Database;
use Drupal\Core\Serialization\Yaml;
use Drupal\views\Tests\ViewTestData;
$connection = Database::getConnection();
// Install the views_test_data module.
$extensions = $connection->select('config')
->fields('config', ['data'])
->condition('collection', '')
->condition('name', 'core.extension')
->execute()
->fetchField();
$extensions = unserialize($extensions);
$extensions['module']['views_test_data'] = 8000;
$connection->update('config')
->fields([
'data' => serialize($extensions),
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute();
$views_configs = [];
// A view that should depend on views_data_test.
$views_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/views.view.test_table_dependency_update.yml'));
foreach ($views_configs as $views_config) {
$connection->insert('config')
->fields([
'collection',
'name',
'data',
])
->values([
'collection' => '',
'name' => 'views.view.' . $views_config['id'],
'data' => serialize($views_config),
])
->execute();
}
// We need the views_test_data table to exist and state entries for
// views_test_data_schema() and views_test_data_views_data().
$schema = ViewTestData::schemaDefinition();
$connection->schema()->createTable('views_test_data', $schema['views_test_data']);
$connection->insert('key_value')
->fields([
'collection',
'name',
'value',
])
->values([
'collection' => 'state',
'name' => 'views_test_data_schema',
'value' => serialize($schema),
])
->values([
'collection' => 'state',
'name' => 'views_test_data_views_data',
'value' => serialize(ViewTestData::viewsData()),
])
->execute();
@@ -0,0 +1,243 @@
uuid: 67e001ab-bf26-4317-98a0-9ef7c8e6773a
langcode: en
status: true
dependencies:
module:
- node
- system
- user
id: legacy_bulk_form
label: 'legacy bulk form'
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: mini
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: ‹‹
next: ››
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:
nid:
id: nid
table: node_field_data
field: nid
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
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
node_bulk_form:
id: node_bulk_form
table: node
field: node_bulk_form
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
action_title: Action
include_exclude: exclude
selected_actions: { }
entity_type: node
plugin_id: bulk_form
filters:
status:
value: '1'
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: { }
arguments: { }
display_extenders: { }
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- 'user.node_grants:view'
- user.permissions
tags: { }
@@ -0,0 +1,226 @@
langcode: en
status: true
dependencies:
module:
- node
- user
id: node_link_update_test
label: 'node link update test'
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: mini
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: ‹‹
next: ››
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
settings:
link_to_entity: true
plugin_id: field
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
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
path:
id: path
table: node
field: path
entity_type: node
plugin_id: node_path
view_node:
id: view_node
table: node
field: view_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: view
entity_type: node
plugin_id: entity_link
filters:
status:
value: '1'
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: { }
arguments: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- 'user.node_grants:view'
- user.permissions
tags: { }
@@ -0,0 +1,266 @@
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.teaser
module:
- node
- user
id: placeholder_text_test
label: 'Placeholder text test'
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: mini
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: ‹‹
next: ››
style:
type: table
options:
grouping: { }
row_class: ''
default_row_class: true
override: true
sticky: false
caption: ''
summary: ''
description: ''
columns:
title: title
info:
title:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
default: '-1'
empty_table: false
row:
type: 'entity:node'
options:
view_mode: teaser
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
settings:
link_to_entity: true
plugin_id: field
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
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:
title:
id: title
table: node_field_data
field: title
relationship: none
group_type: group
admin_label: ''
operator: '='
value: ''
group: 1
exposed: true
expose:
operator_id: title_op
label: Title
description: ''
use_operator: false
operator: title_op
identifier: title
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
entity_type: node
entity_field: title
plugin_id: string
created:
id: created
table: node_field_data
field: created
relationship: none
group_type: group
admin_label: ''
operator: '='
value:
min: ''
max: ''
value: ''
type: date
group: 1
exposed: true
expose:
operator_id: created_op
label: 'Authored on'
description: ''
use_operator: false
operator: created_op
identifier: created
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
entity_type: node
entity_field: created
plugin_id: date
sorts: { }
title: 'Placeholder text test'
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
filter_groups:
operator: AND
groups:
1: AND
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- url.query_args
- 'user.node_grants:view'
- user.permissions
tags: { }
page_1:
display_plugin: page
id: page_1
display_title: Page
position: 1
display_options:
display_extenders: { }
path: placeholder-text-test
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- url.query_args
- 'user.node_grants:view'
- user.permissions
tags: { }
@@ -0,0 +1,79 @@
langcode: en
status: true
dependencies: { }
id: test_table_dependency_update
label: ''
module: views
description: ''
tag: ''
base_table: views_test_data
base_field: nid
core: '8'
display:
default:
display_options:
defaults:
fields: false
pager: false
sorts: false
fields:
id:
field: id
id: id
relationship: none
table: views_test_data
plugin_id: numeric
pager:
options:
offset: 0
type: none
sorts:
id:
field: id
id: id
order: ASC
relationship: none
table: views_test_data
plugin_id: numeric
empty:
title:
field: title
id: title
table: views
plugin_id: title
title: test_title_empty
header:
result:
id: result
table: views
field: result
relationship: none
group_type: group
admin_label: ''
empty: true
content: "start: @start | end: @end | total: @total | label: @label | per page: @per_page | current page: @current_page | current record count: @current_record_count | page count: @page_count"
plugin_id: result
display_plugin: default
display_title: Master
id: default
position: 0
page_1:
display_options:
path: test-area-result
defaults:
header: false
header:
result:
id: result
table: views
field: result
relationship: none
group_type: group
admin_label: ''
empty: false
content: "start: @start | end: @end | total: @total | label: @label | per page: @per_page | current page: @current_page | current record count: @current_record_count | page count: @page_count"
plugin_id: result
display_plugin: page
display_title: 'Page 1'
id: page_1
position: 1
@@ -0,0 +1,185 @@
langcode: en
status: true
dependencies:
module:
- node
- user
id: test_table_max_age
label: test-table-max-age
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: mini
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: ‹‹
next: ››
style:
type: table
options:
grouping: { }
row_class: ''
default_row_class: true
override: true
sticky: false
caption: ''
summary: ''
description: ''
columns:
title: title
info:
title:
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:
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
settings:
link_to_entity: true
plugin_id: field
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
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: '1'
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: { }
arguments: { }
display_extenders: { }
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- 'user.node_grants:view'
- user.permissions
tags: { }
@@ -8,8 +8,8 @@ dependencies:
- views
- entity_test
# Information added by Drupal.org packaging script on 2018-01-03
version: '8.4.4'
# Information added by Drupal.org packaging script on 2018-03-07
version: '8.5.0'
core: '8.x'
project: 'drupal'
datestamp: 1515021228
datestamp: 1520457825
@@ -30,7 +30,7 @@ display:
name:
id: name
table: entity_test_multivalue_basefield__name
field: name
field: name_value
plugin_id: field
entity_type: entity_test_multivalue_basefield
entity_field: name
@@ -296,6 +296,112 @@ display:
text: 'Delete entity test'
entity_type: entity_test
plugin_id: entity_link_delete
canonical_entity_test:
id: canonical_entity_test
table: entity_test
field: view_entity_test
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: ''
output_url_as_text: true
absolute: false
entity_type: entity_test
plugin_id: entity_link
absolute_entity_test:
id: absolute_entity_test
table: entity_test
field: view_entity_test
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: ''
output_url_as_text: true
absolute: true
entity_type: entity_test
plugin_id: entity_link
filters: { }
sorts:
id:
@@ -0,0 +1,339 @@
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.teaser
module:
- node
id: test_filter_placeholder_text
label: 'Test filter placeholder text'
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: 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: some
options:
items_per_page: 10
offset: 0
style:
type: table
options:
grouping: { }
row_class: ''
default_row_class: true
override: true
sticky: false
caption: ''
summary: ''
description: ''
columns:
title: title
info:
title:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
default: '-1'
empty_table: false
row:
type: 'entity:node'
options:
view_mode: teaser
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
settings:
link_to_entity: true
plugin_id: field
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
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:
title:
id: title
table: node_field_data
field: title
relationship: none
group_type: group
admin_label: ''
operator: '='
value: ''
group: 1
exposed: true
expose:
operator_id: title_op
label: Title
description: ''
use_operator: false
operator: title_op
identifier: title
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
placeholder: ''
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
entity_type: node
entity_field: title
plugin_id: string
title_1:
id: title_1
table: node_field_data
field: title
relationship: none
group_type: group
admin_label: ''
operator: '='
value: ''
group: 1
exposed: true
expose:
operator_id: title_1_op
label: Title
description: ''
use_operator: false
operator: title_1_op
identifier: title_with_placeholder
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
placeholder: 'title placeholder'
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
entity_type: node
entity_field: title
plugin_id: string
created:
id: created
table: node_field_data
field: created
relationship: none
group_type: group
admin_label: ''
operator: '='
value:
min: ''
max: ''
value: ''
type: date
group: 1
exposed: true
expose:
operator_id: created_op
label: 'Authored on'
description: ''
use_operator: true
operator: created_op
identifier: created
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
placeholder: ''
min_placeholder: ''
max_placeholder: ''
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
entity_type: node
entity_field: created
plugin_id: date
created_1:
id: created_1
table: node_field_data
field: created
relationship: none
group_type: group
admin_label: ''
operator: '='
value:
min: ''
max: ''
value: ''
type: date
group: 1
exposed: true
expose:
operator_id: created_with_placeholders_op
label: 'Authored on'
description: ''
use_operator: true
operator: created_1_op
identifier: created_with_placeholders
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
placeholder: 'created placeholder'
min_placeholder: 'min placeholder'
max_placeholder: 'max placeholder'
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
entity_type: node
entity_field: created
plugin_id: date
sorts: { }
title: 'Placeholder text test'
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
filter_groups:
operator: AND
groups:
1: AND
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- 'user.node_grants:view'
tags: { }
page_1:
display_plugin: page
id: page_1
display_title: Page
position: 1
display_options:
display_extenders: { }
path: placeholder-text-test
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- 'user.node_grants:view'
tags: { }
@@ -7,8 +7,8 @@ package: Testing
dependencies:
- views
# Information added by Drupal.org packaging script on 2018-01-03
version: '8.4.4'
# Information added by Drupal.org packaging script on 2018-03-07
version: '8.5.0'
core: '8.x'
project: 'drupal'
datestamp: 1515021228
datestamp: 1520457825
@@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Simple form page callback to test the view element.
*
* @internal
*/
class ViewsTestDataElementEmbedForm extends FormBase {
@@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Simple form page callback to test the view element.
*
* @internal
*/
class ViewsTestDataElementForm extends FormBase {
@@ -151,4 +151,9 @@ class QueryTest extends QueryPluginBase {
];
}
/**
* {@inheritdoc}
*/
public function setFieldTimezoneOffset(&$field, $offset) {}
}
@@ -7,8 +7,8 @@ package: Testing
dependencies:
- views
# Information added by Drupal.org packaging script on 2018-01-03
version: '8.4.4'
# Information added by Drupal.org packaging script on 2018-03-07
version: '8.5.0'
core: '8.x'
project: 'drupal'
datestamp: 1515021228
datestamp: 1520457825
@@ -7,8 +7,8 @@ package: Testing
dependencies:
- views
# Information added by Drupal.org packaging script on 2018-01-03
version: '8.4.4'
# Information added by Drupal.org packaging script on 2018-03-07
version: '8.5.0'
core: '8.x'
project: 'drupal'
datestamp: 1515021228
datestamp: 1520457825
@@ -8,8 +8,8 @@ dependencies:
- views
- language
# Information added by Drupal.org packaging script on 2018-01-03
version: '8.4.4'
# Information added by Drupal.org packaging script on 2018-03-07
version: '8.5.0'
core: '8.x'
project: 'drupal'
datestamp: 1515021228
datestamp: 1520457825
@@ -73,7 +73,10 @@ class FieldEntityOperationsTest extends ViewTestBase {
$this->assertTrue(count($operations) > 0, 'There are operations.');
foreach ($operations as $operation) {
$expected_destination = Url::fromUri('internal:/test-entity-operations')->toString();
$result = $this->xpath('//ul[contains(@class, dropbutton)]/li/a[@href=:path and text()=:title]', [':path' => $operation['url']->toString() . '?destination=' . $expected_destination, ':title' => (string) $operation['title']]);
// Update destination property of the URL as generating it in the
// test would by default point to the frontpage.
$operation['url']->setOption('query', ['destination' => $expected_destination]);
$result = $this->xpath('//ul[contains(@class, dropbutton)]/li/a[@href=:path and text()=:title]', [':path' => $operation['url']->toString(), ':title' => (string) $operation['title']]);
$this->assertEqual(count($result), 1, t('Found entity @operation link with destination parameter.', ['@operation' => $operation['title']]));
// Entities which were created in Hungarian should link to the Hungarian
// edit form, others to the English one (which has no path prefix here).
@@ -0,0 +1,61 @@
<?php
namespace Drupal\Tests\views\Functional\Handler;
use Drupal\Tests\views\Functional\ViewTestBase;
/**
* Tests the placeholder text on the appropriate filter handlers.
*
* @group views
*/
class FilterPlaceholderTextTest extends ViewTestBase {
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = ['test_filter_placeholder_text'];
/**
* {@inheritdoc}
*/
public static $modules = ['node'];
/**
* Tests that HTML placeholders are added, when appropriate.
*/
public function testPlaceholderText() {
$this->drupalGet('placeholder-text-test');
// String filter that has no placeholder configured.
$results = $this->cssSelect('input[name=title]');
$this->assertFalse($results[0]->hasAttribute('placeholder'));
// String filter that has placeholder configured.
$results = $this->cssSelect('input[name=title_with_placeholder]');
$this->assertTrue($results[0]->hasAttribute('placeholder'));
$this->assertEquals('title placeholder', $results[0]->getAttribute('placeholder'));
// Numeric filter that has no placeholders configured.
$results = $this->cssSelect('input[name="created[value]"]');
$this->assertFalse($results[0]->hasAttribute('placeholder'));
$results = $this->cssSelect('input[name="created[min]"]');
$this->assertFalse($results[0]->hasAttribute('placeholder'));
$results = $this->cssSelect('input[name="created[max]"]');
$this->assertFalse($results[0]->hasAttribute('placeholder'));
// Numeric filter that has all placeholders configured.
$results = $this->cssSelect('input[name="created_with_placeholders[value]"]');
$this->assertTrue($results[0]->hasAttribute('placeholder'));
$this->assertEquals('created placeholder', $results[0]->getAttribute('placeholder'));
$results = $this->cssSelect('input[name="created_with_placeholders[min]"]');
$this->assertTrue($results[0]->hasAttribute('placeholder'));
$this->assertEquals('min placeholder', $results[0]->getAttribute('placeholder'));
$results = $this->cssSelect('input[name="created_with_placeholders[max]"]');
$this->assertTrue($results[0]->hasAttribute('placeholder'));
$this->assertEquals('max placeholder', $results[0]->getAttribute('placeholder'));
}
}
@@ -2,6 +2,7 @@
namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Entity\View;
@@ -229,4 +230,18 @@ class StyleTableTest extends ViewTestBase {
}
}
/**
* Tests the cacheability of the table display.
*/
public function testTableCacheability() {
\Drupal::service('module_installer')->uninstall(['page_cache']);
$url = 'test-table';
$this->drupalGet($url);
$this->assertSession()->statusCodeEquals(200);
$this->assertEquals('MISS', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER));
$this->drupalGet($url);
$this->assertEquals('HIT', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER));
}
}
@@ -0,0 +1,40 @@
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Entity\View;
/**
* Tests Views image style dependencies update.
*
* @group views
*/
class BulkFormUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/legacy-bulk-form-update.php'
];
}
/**
* Tests the updating of dependencies for Views using the bulk_form plugin.
*/
public function testBulkFormDependencies() {
$module_dependencies = View::load('legacy_bulk_form')->getDependencies()['module'];
$this->assertTrue(in_array('system', $module_dependencies));
$this->runUpdates();
$module_dependencies = View::load('legacy_bulk_form')->getDependencies()['module'];
$this->assertFalse(in_array('system', $module_dependencies));
}
}
@@ -0,0 +1,43 @@
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Entity\View;
/**
* Tests the upgrade path for placeholder text.
*
* @see views_post_update_filter_placeholder_text()
*
* @group Update
*/
class PlaceholderTextUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/filter-placeholder-text.php',
];
}
/**
* Tests that boolean filter values are updated properly.
*/
public function testViewsPostUpdatePlaceholderText() {
$this->runUpdates();
// Load and initialize our test view.
$view = View::load('placeholder_text_test');
$data = $view->toArray();
// Check that new settings exist.
$this->assertArrayHasKey('placeholder', $data['display']['default']['display_options']['filters']['title']['expose']);
$this->assertArrayHasKey('placeholder', $data['display']['default']['display_options']['filters']['created']['expose']);
$this->assertArrayHasKey('min_placeholder', $data['display']['default']['display_options']['filters']['created']['expose']);
$this->assertArrayHasKey('max_placeholder', $data['display']['default']['display_options']['filters']['created']['expose']);
}
}
@@ -0,0 +1,44 @@
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Entity\View;
/**
* Tests the upgrade path for cache max age with table displays.
*
* @see views_post_update_table_display_cache_max_age()
*
* @group Update
*/
class TableDisplayCacheMaxAgeTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/table-cache-max-age.php',
];
}
/**
* Tests the upgrade path for cache max age with table displays.
*/
public function testViewsPostUpdateTableDisplayMaxCacheAge() {
$view = View::load('test_table_max_age');
$data = $view->toArray();
$this->assertSame(0, $data['display']['default']['cache_metadata']['max-age']);
$this->runUpdates();
// Load and initialize our test view.
$view = View::load('test_table_max_age');
$data = $view->toArray();
// Check that the field is using the expected max age value.
$this->assertSame(-1, $data['display']['default']['cache_metadata']['max-age']);
}
}
@@ -0,0 +1,40 @@
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Views;
/**
* Tests the upgrade path for views data table provider dependencies.
*
* @see views_post_update_views_data_table_dependencies()
*
* @group Update
*/
class ViewsDataTableDependencyUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.4.0.bare.standard.php.gz',
// This creates a view called test_table_dependency_update which has no
// dependencies.
__DIR__ . '/../../../fixtures/update/views-data-table-dependency.php',
];
}
/**
* Tests that dependencies are correct after update.
*/
public function testPostUpdate() {
$this->runUpdates();
// Load and initialize our test view.
$view = Views::getView('test_table_dependency_update');
$this->assertEquals(['module' => ['views_test_data']], $view->getDependencies());
}
}
@@ -163,8 +163,9 @@ class BasicTest extends WizardTestBase {
$this->drupalPostForm('admin/structure/views/add', $view4, t('Save and edit'));
$this->assertRaw(t('The view %view has been saved.', ['%view' => $view4['label']]));
// Check that the REST export path works.
$this->drupalGet($view4['rest_export[path]']);
// Check that the REST export path works. JSON will work, as all core
// formats will be allowed. JSON and XML by default.
$this->drupalGet($view4['rest_export[path]'], ['query' => ['_format' => 'json']]);
$this->assertResponse(200);
$data = Json::decode($this->getSession()->getPage()->getContent());
$this->assertEqual(count($data), 1, 'Only the node of type page is exported.');
@@ -30,12 +30,6 @@ class GlossaryViewTest extends JavascriptTestBase {
*/
public static $testViews = ['test_glossary'];
/**
* @var
* The additional language to use.
*/
protected $language;
/**
* {@inheritdoc}
*/
@@ -99,7 +93,7 @@ class GlossaryViewTest extends JavascriptTestBase {
* Test that the glossary also works on a language prefixed URL.
*/
public function testGlossaryLanguagePrefix() {
$this->language = ConfigurableLanguage::createFromLangcode('nl')->save();
ConfigurableLanguage::createFromLangcode('nl')->save();
$config = $this->config('language.negotiation');
$config->set('url.prefixes', ['en' => 'en', 'nl' => 'nl'])
@@ -162,6 +162,7 @@ class ViewEntityDependenciesTest extends ViewsKernelTestBase {
],
'module' => [
'core',
'node',
'text',
'views'
],
@@ -194,6 +194,7 @@ class AreaEntityTest extends ViewsKernelTestBase {
$this->assertEqual([
'config' => ['block.block.test_block'],
'content' => ['entity_test:entity_test:aa0c61cb-b7bb-4795-972a-493dabcf529c'],
'module' => ['views_test_data'],
], $dependencies);
}
@@ -36,7 +36,7 @@ class AreaViewTest extends ViewsKernelTestBase {
$view = Views::getView('test_area_view');
// Tests \Drupal\views\Plugin\views\area\View::calculateDependencies().
$this->assertIdentical(['config' => ['views.view.test_simple_argument']], $view->getDependencies());
$this->assertIdentical(['config' => ['views.view.test_simple_argument'], 'module' => ['views_test_data']], $view->getDependencies());
$this->executeView($view);
$output = $view->render();
@@ -67,11 +67,11 @@ class FieldEntityLinkTest extends ViewsKernelTestBase {
*/
public function testEntityLink() {
// Anonymous users cannot see edit/delete links.
$expected_results = ['canonical' => TRUE, 'edit-form' => FALSE, 'delete-form' => FALSE];
$expected_results = ['canonical' => TRUE, 'edit-form' => FALSE, 'delete-form' => FALSE, 'canonical_raw' => TRUE, 'canonical_raw_absolute' => TRUE];
$this->doTestEntityLink(\Drupal::currentUser(), $expected_results);
// Admin users cannot see all links.
$expected_results = ['canonical' => TRUE, 'edit-form' => TRUE, 'delete-form' => TRUE];
$expected_results = ['canonical' => TRUE, 'edit-form' => TRUE, 'delete-form' => TRUE, 'canonical_raw' => TRUE, 'canonical_raw_absolute' => TRUE];
$this->doTestEntityLink($this->adminUser, $expected_results);
}
@@ -94,16 +94,39 @@ class FieldEntityLinkTest extends ViewsKernelTestBase {
'label' => 'View entity test',
'field_id' => 'view_entity_test',
'destination' => FALSE,
'link' => TRUE,
'options' => [],
'relationship' => 'canonical',
],
'edit-form' => [
'label' => 'Edit entity test',
'field_id' => 'edit_entity_test',
'destination' => TRUE,
'link' => TRUE,
'options' => [],
'relationship' => 'edit-form',
],
'delete-form' => [
'label' => 'Delete entity test',
'field_id' => 'delete_entity_test',
'destination' => TRUE,
'link' => TRUE,
'options' => [],
'relationship' => 'delete-form',
],
'canonical_raw' => [
'field_id' => 'canonical_entity_test',
'destination' => FALSE,
'link' => FALSE,
'options' => [],
'relationship' => 'canonical',
],
'canonical_raw_absolute' => [
'field_id' => 'absolute_entity_test',
'destination' => FALSE,
'link' => FALSE,
'options' => ['absolute' => TRUE],
'relationship' => 'canonical',
],
];
@@ -112,9 +135,14 @@ class FieldEntityLinkTest extends ViewsKernelTestBase {
foreach ($expected_results as $template => $expected_result) {
$expected_link = '';
if ($expected_result) {
$path = $entity->url($template);
$path = $entity->url($info[$template]['relationship'], $info[$template]['options']);
$destination = $info[$template]['destination'] ? '?destination=/' : '';
$expected_link = '<a href="' . $path . $destination . '" hreflang="en">' . $info[$template]['label'] . '</a>';
if ($info[$template]['link']) {
$expected_link = '<a href="' . $path . $destination . '" hreflang="en">' . $info[$template]['label'] . '</a>';
}
else {
$expected_link = $path;
}
}
$link = $view->style_plugin->getField($index, $info[$template]['field_id']);
$this->assertEqual($link, $expected_link);
@@ -131,7 +131,7 @@ class DisplayPageTest extends ViewsKernelTestBase {
*/
public function testDependencies() {
$view = Views::getView('test_page_display');
$this->assertIdentical([], $view->getDependencies());
$this->assertIdentical(['module' => ['views_test_data']], $view->getDependencies());
$view = Views::getView('test_page_display_route');
$expected = [
@@ -146,6 +146,9 @@ class DisplayPageTest extends ViewsKernelTestBase {
'system.menu.admin',
'system.menu.tools',
],
'module' => [
'views_test_data',
],
];
$this->assertIdentical($expected, $view->getDependencies());
}
@@ -71,16 +71,12 @@ class StyleGridTest extends PluginKernelTestBase {
switch ($columns) {
case 5: $width = '20';
break;
case 4: $width = '25';
break;
case 3: $width = '33.3333';
break;
case 2: $width = '50';
break;
case 1: $width = '100';
break;
}
@@ -18,6 +18,7 @@ use Drupal\Core\Field\Plugin\Field\FieldType\LanguageItem;
use Drupal\Core\Field\Plugin\Field\FieldType\StringItem;
use Drupal\Core\Field\Plugin\Field\FieldType\UriItem;
use Drupal\Core\Field\Plugin\Field\FieldType\UuidItem;
use Drupal\Core\State\StateInterface;
use Drupal\Core\TypedData\TypedDataManagerInterface;
use Drupal\text\Plugin\Field\FieldType\TextLongItem;
use Drupal\entity_test\Entity\EntityTest;
@@ -25,6 +26,7 @@ use Drupal\entity_test\Entity\EntityTestMul;
use Drupal\entity_test\Entity\EntityTestMulRev;
use Drupal\Tests\UnitTestCase;
use Drupal\views\EntityViewsData;
use Prophecy\Argument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
@@ -91,8 +93,10 @@ class EntityViewsDataTest extends UnitTestCase {
$typed_data_manager->expects($this->any())
->method('getDefinition')
->with($this->equalTo('field_item:string_long'))
->willReturn(['class' => '\Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem']);
->will($this->returnValueMap([
'entity:user' => ['class' => '\Drupal\Core\TypedData\DataDefinitionInterface'],
'field_item:string_long' => ['class' => '\Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem'],
]));
$this->baseEntityType = new TestEntityType([
'base_table' => 'entity_test',
@@ -110,6 +114,7 @@ class EntityViewsDataTest extends UnitTestCase {
]);
$this->translationManager = $this->getStringTranslationStub();
$this->baseEntityType->setStringTranslation($this->translationManager);
$this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
$this->viewsData = new TestEntityViewsData($this->baseEntityType, $this->entityStorage, $this->entityManager, $this->moduleHandler, $this->translationManager);
@@ -124,10 +129,14 @@ class EntityViewsDataTest extends UnitTestCase {
->method('getDefaultFieldSettings')
->willReturn([]);
$state = $this->prophesize(StateInterface::class);
$state->get(Argument::any(), [])->willReturn([]);
$container = new ContainerBuilder();
$container->set('plugin.manager.field.field_type', $field_type_manager);
$container->set('entity.manager', $this->entityManager);
$container->set('typed_data_manager', $typed_data_manager);
$container->set('state', $state->reveal());
\Drupal::setContainer($container);
}
@@ -474,7 +483,7 @@ class EntityViewsDataTest extends UnitTestCase {
['description', ['value' => 'description__value', 'format' => 'description__format']],
['homepage', ['value' => 'homepage']],
['user_id', ['target_id' => 'user_id']],
['string', ['value' => 'value']],
['string', ['value' => 'string_value']],
]);
$table_mapping->expects($this->any())
->method('getFieldNames')
@@ -531,8 +540,12 @@ class EntityViewsDataTest extends UnitTestCase {
$this->assertEquals('users_field_data', $relationship['base']);
$this->assertEquals('uid', $relationship['base field']);
$this->assertStringField($data['entity_test__string']['string']);
$this->assertField($data['entity_test__string']['string'], 'string');
// The string field name should be used as the 'entity field' but the actual
// field should reflect what the column mapping is using for multi-value
// base fields NOT just the field name. The actual column name returned from
// mappings in the test mocks is 'value'.
$this->assertStringField($data['entity_test__string']['string_value']);
$this->assertField($data['entity_test__string']['string_value'], 'string');
$this->assertEquals([
'left_field' => 'id',
'field' => 'entity_id',
@@ -596,7 +609,7 @@ class EntityViewsDataTest extends UnitTestCase {
['description', ['value' => 'description__value', 'format' => 'description__format']],
['homepage', ['value' => 'homepage']],
['user_id', ['target_id' => 'user_id']],
['string', ['value' => 'value']],
['string', ['value' => 'string_value']],
]);
$table_mapping->expects($this->any())
->method('getFieldNames')
@@ -686,8 +699,8 @@ class EntityViewsDataTest extends UnitTestCase {
$this->assertEquals('users_field_data', $relationship['base']);
$this->assertEquals('uid', $relationship['base field']);
$this->assertStringField($data['entity_test_mul__string']['string']);
$this->assertField($data['entity_test_mul__string']['string'], 'string');
$this->assertStringField($data['entity_test_mul__string']['string_value']);
$this->assertField($data['entity_test_mul__string']['string_value'], 'string');
$this->assertEquals([
'left_field' => 'id',
'field' => 'entity_id',
@@ -746,8 +759,8 @@ class EntityViewsDataTest extends UnitTestCase {
['description', ['value' => 'description__value', 'format' => 'description__format']],
['homepage', ['value' => 'homepage']],
['user_id', ['target_id' => 'user_id']],
['revision_id', ['value' => 'id']],
['string', ['value' => 'value']],
['revision_id', ['value' => 'revision_id']],
['string', ['value' => 'string_value']],
]);
$table_mapping->expects($this->any())
->method('getFieldNames')
@@ -872,8 +885,8 @@ class EntityViewsDataTest extends UnitTestCase {
$this->assertEquals('users_field_data', $relationship['base']);
$this->assertEquals('uid', $relationship['base field']);
$this->assertStringField($data['entity_test_mulrev__string']['string']);
$this->assertField($data['entity_test_mulrev__string']['string'], 'string');
$this->assertStringField($data['entity_test_mulrev__string']['string_value']);
$this->assertField($data['entity_test_mulrev__string']['string_value'], 'string');
$this->assertEquals([
'left_field' => 'id',
'field' => 'entity_id',
@@ -885,8 +898,8 @@ class EntityViewsDataTest extends UnitTestCase {
],
], $data['entity_test_mulrev__string']['table']['join']['entity_test_mulrev_property_data']);
$this->assertStringField($data['entity_test_mulrev_revision__string']['string']);
$this->assertField($data['entity_test_mulrev_revision__string']['string'], 'string');
$this->assertStringField($data['entity_test_mulrev_revision__string']['string_value']);
$this->assertField($data['entity_test_mulrev_revision__string']['string_value'], 'string');
$this->assertEquals([
'left_field' => 'revision_id',
'field' => 'entity_id',
@@ -70,7 +70,7 @@ class ViewsBlockTest extends UnitTestCase {
$this->executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
->disableOriginalConstructor()
->setMethods(['buildRenderable', 'setDisplay', 'setItemsPerPage'])
->setMethods(['buildRenderable', 'setDisplay', 'setItemsPerPage', 'getShowAdminLinks'])
->getMock();
$this->executable->expects($this->any())
->method('setDisplay')
@@ -7,6 +7,7 @@ use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityType;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\views\Plugin\views\query\DateSqlInterface;
use Drupal\views\Plugin\views\query\Sql;
use Drupal\views\Plugin\views\relationship\RelationshipPluginBase;
use Drupal\views\ResultRow;
@@ -29,8 +30,9 @@ class SqlTest extends UnitTestCase {
public function testGetCacheTags() {
$view = $this->prophesize('Drupal\views\ViewExecutable')->reveal();
$entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
$date_sql = $this->prophesize(DateSqlInterface::class);
$query = new Sql([], 'sql', [], $entity_type_manager->reveal());
$query = new Sql([], 'sql', [], $entity_type_manager->reveal(), $date_sql->reveal());
$query->view = $view;
$result = [];
@@ -75,8 +77,9 @@ class SqlTest extends UnitTestCase {
public function testGetCacheMaxAge() {
$view = $this->prophesize('Drupal\views\ViewExecutable')->reveal();
$entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
$date_sql = $this->prophesize(DateSqlInterface::class);
$query = new Sql([], 'sql', [], $entity_type_manager->reveal());
$query = new Sql([], 'sql', [], $entity_type_manager->reveal(), $date_sql->reveal());
$query->view = $view;
$view->result = [];
@@ -249,8 +252,9 @@ class SqlTest extends UnitTestCase {
$view->storage = $view_entity->reveal();
$entity_type_manager = $this->setupEntityTypes();
$date_sql = $this->prophesize(DateSqlInterface::class);
$query = new Sql([], 'sql', [], $entity_type_manager->reveal());
$query = new Sql([], 'sql', [], $entity_type_manager->reveal(), $date_sql->reveal());
$query->view = $view;
$result = [];
@@ -277,8 +281,9 @@ class SqlTest extends UnitTestCase {
],
];
$entity_type_manager = $this->setupEntityTypes($entities);
$date_sql = $this->prophesize(DateSqlInterface::class);
$query = new Sql([], 'sql', [], $entity_type_manager->reveal());
$query = new Sql([], 'sql', [], $entity_type_manager->reveal(), $date_sql->reveal());
$query->view = $view;
$result = [];
@@ -340,8 +345,9 @@ class SqlTest extends UnitTestCase {
],
];
$entity_type_manager = $this->setupEntityTypes($entities);
$date_sql = $this->prophesize(DateSqlInterface::class);
$query = new Sql([], 'sql', [], $entity_type_manager->reveal());
$query = new Sql([], 'sql', [], $entity_type_manager->reveal(), $date_sql->reveal());
$query->view = $view;
$result = [];
@@ -394,8 +400,9 @@ class SqlTest extends UnitTestCase {
],
];
$entity_type_manager = $this->setupEntityTypes($entities);
$date_sql = $this->prophesize(DateSqlInterface::class);
$query = new Sql([], 'sql', [], $entity_type_manager->reveal());
$query = new Sql([], 'sql', [], $entity_type_manager->reveal(), $date_sql->reveal());
$query->view = $view;
$result = [];
@@ -444,8 +451,9 @@ class SqlTest extends UnitTestCase {
],
];
$entity_type_manager = $this->setupEntityTypes([], $entity_revisions);
$date_sql = $this->prophesize(DateSqlInterface::class);
$query = new Sql([], 'sql', [], $entity_type_manager->reveal());
$query = new Sql([], 'sql', [], $entity_type_manager->reveal(), $date_sql->reveal());
$query->view = $view;
$result = [];
@@ -497,8 +505,9 @@ class SqlTest extends UnitTestCase {
],
];
$entity_type_manager = $this->setupEntityTypes($entity, $entity_revisions);
$date_sql = $this->prophesize(DateSqlInterface::class);
$query = new Sql([], 'sql', [], $entity_type_manager->reveal());
$query = new Sql([], 'sql', [], $entity_type_manager->reveal(), $date_sql->reveal());
$query->view = $view;
$result = [];
@@ -554,8 +563,9 @@ class SqlTest extends UnitTestCase {
],
];
$entity_type_manager = $this->setupEntityTypes($entities, $entity_revisions);
$date_sql = $this->prophesize(DateSqlInterface::class);
$query = new Sql([], 'sql', [], $entity_type_manager->reveal());
$query = new Sql([], 'sql', [], $entity_type_manager->reveal(), $date_sql->reveal());
$query->view = $view;
$result = [];
@@ -0,0 +1,97 @@
<?php
namespace Drupal\Tests\views\Unit\Plugin\views\query;
use Drupal\Core\Database\Connection;
use Drupal\Tests\UnitTestCase;
use Drupal\views\Plugin\views\query\MysqlDateSql;
/**
* Tests the MySQL-specific date query handler.
*
* @coversDefaultClass \Drupal\views\Plugin\views\query\MysqlDateSql
*
* @group views
*/
class MysqlDateSqlTest extends UnitTestCase {
/**
* The mocked database service.
*
* @var \Drupal\Core\Database\Connection
*/
protected $database;
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->database = $this->prophesize(Connection::class)->reveal();
}
/**
* Tests the getDateField method.
*
* @covers ::getDateField
*/
public function testGetDateField() {
$date_sql = new MysqlDateSql($this->database);
$expected = 'foo.field';
$this->assertEquals($expected, $date_sql->getDateField('foo.field', TRUE));
$expected = "DATE_ADD('19700101', INTERVAL foo.field SECOND)";
$this->assertEquals($expected, $date_sql->getDateField('foo.field', FALSE));
}
/**
* Tests date formatting replacement.
*
* @covers ::getDateFormat
*
* @dataProvider providerTestGetDateFormat
*/
public function testGetDateFormat($field, $format, $expected_format) {
$date_sql = new MysqlDateSql($this->database);
$this->assertEquals("DATE_FORMAT($field, '$expected_format')", $date_sql->getDateFormat($field, $format));
}
/**
* Provider for date formatting test.
*/
public function providerTestGetDateFormat() {
return [
['foo.field', 'Y-y-M-m', '%Y-%y-%b-%m'],
['bar.field', 'n-F D d l', '%c-%M %a %d %W'],
['baz.bar_field', 'j/W/H-h i s A', '%e/%v/%H-%h %i %s %p'],
];
}
/**
* Tests timezone offset formatting.
*
* @covers ::setFieldTimezoneOffset
*/
public function testSetFieldTimezoneOffset() {
$date_sql = new MysqlDateSql($this->database);
$field = 'foobar.field';
$date_sql->setFieldTimezoneOffset($field, 42);
$this->assertEquals("(foobar.field + INTERVAL 42 SECOND)", $field);
}
/**
* Tests setting the database offset.
*
* @covers ::setTimezoneOffset
*/
public function testSetTimezoneOffset() {
$database = $this->prophesize(Connection::class);
$database->query("SET @@session.time_zone = '42'")->shouldBeCalledTimes(1);
$date_sql = new MysqlDateSql($database->reveal());
$date_sql->setTimezoneOffset(42);
}
}
@@ -0,0 +1,97 @@
<?php
namespace Drupal\Tests\views\Unit\Plugin\views\query;
use Drupal\Core\Database\Connection;
use Drupal\Tests\UnitTestCase;
use Drupal\views\Plugin\views\query\PostgresqlDateSql;
/**
* Tests the PostgreSQL-specific date query handler.
*
* @coversDefaultClass \Drupal\views\Plugin\views\query\PostgresqlDateSql
*
* @group views
*/
class PostgresqlDateSqlTest extends UnitTestCase {
/**
* The mocked database service.
*
* @var \Drupal\Core\Database\Connection
*/
protected $database;
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->database = $this->prophesize(Connection::class)->reveal();
}
/**
* Tests the getDateField method.
*
* @covers ::getDateField
*/
public function testGetDateField() {
$date_sql = new PostgresqlDateSql($this->database);
$expected = "TO_TIMESTAMP(foo.field, 'YYYY-MM-DD HH24:MI:SS')";
$this->assertEquals($expected, $date_sql->getDateField('foo.field', TRUE));
$expected = 'TO_TIMESTAMP(foo.field)';
$this->assertEquals($expected, $date_sql->getDateField('foo.field', FALSE));
}
/**
* Tests date formatting replacement.
*
* @covers ::getDateFormat
*
* @dataProvider providerTestGetDateFormat
*/
public function testGetDateFormat($field, $format, $expected_format) {
$date_sql = new PostgresqlDateSql($this->database);
$this->assertEquals("TO_CHAR($field, '$expected_format')", $date_sql->getDateFormat($field, $format));
}
/**
* Provider for date formatting test.
*/
public function providerTestGetDateFormat() {
return [
['foo.field', 'Y-y-M-m', 'YYYY-YY-Mon-MM'],
['bar.field', 'n-F D d l', 'MM-Month Dy DD Day'],
['baz.bar_field', 'j/W/H-h i s A', 'DD/IW/HH24-HH12 MI SS AM'],
];
}
/**
* Tests timezone offset formatting.
*
* @covers ::setFieldTimezoneOffset
*/
public function testSetFieldTimezoneOffset() {
$date_sql = new PostgresqlDateSql($this->database);
$field = 'foobar.field';
$date_sql->setFieldTimezoneOffset($field, 42);
$this->assertEquals("(foobar.field + INTERVAL '42 SECONDS')", $field);
}
/**
* Tests setting the database offset.
*
* @covers ::setTimezoneOffset
*/
public function testSetTimezoneOffset() {
$database = $this->prophesize(Connection::class);
$database->query("SET TIME ZONE INTERVAL '42' HOUR TO MINUTE")->shouldBeCalledTimes(1);
$date_sql = new PostgresqlDateSql($database->reveal());
$date_sql->setTimezoneOffset(42);
}
}
@@ -0,0 +1,98 @@
<?php
namespace Drupal\Tests\views\Unit\Plugin\views\query;
use Drupal\Core\Database\Connection;
use Drupal\Tests\UnitTestCase;
use Drupal\views\Plugin\views\query\SqliteDateSql;
/**
* Tests the MySQL-specific date query handler.
*
* @coversDefaultClass \Drupal\views\Plugin\views\query\SqliteDateSql
*
* @group views
*/
class SqliteDateSqlTest extends UnitTestCase {
/**
* The mocked database service.
*
* @var \Drupal\Core\Database\Connection
*/
protected $database;
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->database = $this->prophesize(Connection::class)->reveal();
}
/**
* Tests the getDateField method.
*
* @covers ::getDateField
*/
public function testGetDateField() {
$date_sql = new SqliteDateSql($this->database);
$expected = "strftime('%s', foo.field)";
$this->assertEquals($expected, $date_sql->getDateField('foo.field', TRUE));
$expected = 'foo.field';
$this->assertEquals($expected, $date_sql->getDateField('foo.field', FALSE));
}
/**
* Tests date formatting replacement.
*
* @covers ::getDateFormat
*
* @dataProvider providerTestGetDateFormat
*/
public function testGetDateFormat($field, $format, $expected) {
$date_sql = new SqliteDateSql($this->database);
$this->assertEquals($expected, $date_sql->getDateFormat($field, $format));
}
/**
* Provider for date formatting test.
*/
public function providerTestGetDateFormat() {
return [
['foo.field', 'Y-y-M-m', "strftime('%Y-%Y-%m-%m', foo.field, 'unixepoch')"],
['bar.field', 'n-F D d l', "strftime('%m-%m %d %d %d', bar.field, 'unixepoch')"],
['baz.bar_field', 'j/W/H-h i s A', "strftime('%d/%W/%H-%H %M %S ', baz.bar_field, 'unixepoch')"],
['foo.field', 'W', "CAST(((strftime('%j', date(strftime('%Y-%m-%d', foo.field, 'unixepoch'), '-3 days', 'weekday 4')) - 1) / 7 + 1) AS NUMERIC)"]
];
}
/**
* Tests timezone offset formatting.
*
* @covers ::setFieldTimezoneOffset
*/
public function testSetFieldTimezoneOffset() {
$date_sql = new SqliteDateSql($this->database);
$field = 'foobar.field';
$date_sql->setFieldTimezoneOffset($field, 42);
$this->assertEquals("(foobar.field + 42)", $field);
}
/**
* Tests setting the database offset.
*
* @covers ::setTimezoneOffset
*/
public function testSetTimezoneOffset() {
$database = $this->prophesize(Connection::class);
$database->query()->shouldNotBeCalled();
$date_sql = new SqliteDateSql($database->reveal());
$date_sql->setTimezoneOffset(42);
}
}
@@ -4,8 +4,8 @@ description: Theme for testing Views rendering of checkboxes.
# version: VERSION
# core: 8.x
# Information added by Drupal.org packaging script on 2018-01-03
version: '8.4.4'
# Information added by Drupal.org packaging script on 2018-03-07
version: '8.5.0'
core: '8.x'
project: 'drupal'
datestamp: 1515021228
datestamp: 1520457825
@@ -4,8 +4,8 @@ description: Theme for testing Views functionality.
# version: VERSION
# core: 8.x
# Information added by Drupal.org packaging script on 2018-01-03
version: '8.4.4'
# Information added by Drupal.org packaging script on 2018-03-07
version: '8.5.0'
core: '8.x'
project: 'drupal'
datestamp: 1515021228
datestamp: 1520457825