Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -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: { }

View file

@ -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: { }

View file

@ -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: { }

View file

@ -601,4 +601,4 @@ display:
- 'user.node_grants:view'
- user.permissions
max-age: 0
tags: { }
tags: { }

View file

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

View file

@ -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: { }

View file

@ -5,5 +5,5 @@ package: Testing
version: VERSION
core: 8.x
dependencies:
- views
- entity_test
- drupal:views
- drupal:entity_test

View file

@ -12,7 +12,6 @@ use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Implements hook_entity_bundle_field_info().
*/
@ -46,3 +45,20 @@ function views_entity_test_entity_field_access($operation, FieldDefinitionInterf
// No opinion.
return AccessResult::neutral();
}
/**
* Implements hook_entity_load().
*
* @see \Drupal\Tests\views\Kernel\Handler\FieldFieldTest::testSimpleExecute()
*/
function views_entity_test_entity_load(array $entities, $entity_type_id) {
if ($entity_type_id === 'entity_test') {
// Cast the value of an entity field to be something else than a string so
// we can check that
// \Drupal\views\Tests\ViewResultAssertionTrait::assertIdenticalResultsetHelper()
// takes care of converting all field values to strings.
foreach ($entities as $entity) {
$entity->user_id->target_id = (int) $entity->user_id->target_id;
}
}
}

View file

@ -0,0 +1,171 @@
langcode: en
status: true
dependencies:
module:
- entity_test
id: computed_field_view
label: 'Computed Field View'
module: views
description: ''
tag: ''
base_table: entity_test_computed_field
base_field: id
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: 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:
computed_string_field:
id: computed_string_field
table: entity_test_computed_field
field: computed_string_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: 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: 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: entity_test_computed_field
plugin_id: field
filters: { }
sorts: { }
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
tags: { }
page_1:
display_plugin: page
id: page_1
display_title: Page
position: 1
display_options:
display_extenders: { }
path: foo
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
tags: { }

View file

@ -0,0 +1,213 @@
langcode: en
status: true
dependencies:
config:
- user.role.authenticated
module:
- node
- rest
- user
id: rest_export_with_authorization_correction
label: 'Rest Export'
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: role
options:
role:
authenticated: authenticated
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: Filter
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
row:
type: 'fields'
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:
id: status
table: node_field_data
field: status
relationship: none
group_type: group
admin_label: ''
operator: '='
value: '0'
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: boolean
entity_type: node
entity_field: status
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
title: 'Rest Export'
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.roles
tags: { }
rest_export_1:
display_plugin: rest_export
id: rest_export_1
display_title: 'REST export'
position: 2
display_options:
display_extenders: { }
path: unpublished-content
auth:
- user
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- request_format
- 'user.node_grants:view'
- user.roles
tags: { }

View file

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

View file

@ -0,0 +1,224 @@
uuid: b133bd43-c494-4db6-83f0-24380fe3964b
langcode: en
status: true
dependencies:
module:
- user
id: test_entity_row_renderers_revisions_base
label: test_entity_row_renderers_revisions_base
module: views
description: ''
tag: ''
base_table: node_field_revision
base_field: vid
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: perm
options:
perm: 'view all revisions'
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:
offset: 0
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_revision
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
uid:
id: uid
table: users_field_data
field: uid
relationship: revision_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
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: user
entity_field: uid
plugin_id: field
filters: { }
sorts: { }
header: { }
footer: { }
empty: { }
relationships:
revision_uid:
id: revision_uid
table: node_revision
field: revision_uid
relationship: none
group_type: group
admin_label: 'revision user'
required: false
entity_type: node
entity_field: revision_uid
plugin_id: standard
arguments: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- 'user.node_grants:view'
- user.permissions
tags: { }

View file

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

View file

@ -0,0 +1,155 @@
langcode: en
status: true
dependencies:
config:
- taxonomy.vocabulary.test_exposed_checkboxes
module:
- node
- taxonomy
id: test_exposed_form_checkboxes
label: ''
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: nid
core: '8'
display:
default:
display_options:
access:
type: none
cache:
type: tag
exposed_form:
options:
reset_button: true
type: basic
filters:
type:
id: type
table: node_field_data
field: type
relationship: none
group_type: group
admin_label: ''
operator: in
value: { }
group: 1
exposed: true
expose:
operator_id: type_op
label: 'Content: Type'
description: 'Exposed description'
use_operator: false
operator: ''
identifier: type
required: false
remember: false
multiple: true
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
reduce: false
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: in_operator
entity_type: node
entity_field: type
tid:
id: tid
table: taxonomy_index
field: tid
relationship: none
group_type: group
admin_label: ''
operator: and
value: { }
group: 1
exposed: true
expose:
operator_id: tid_op
label: 'Has taxonomy term'
description: ''
use_operator: false
operator: tid_op
identifier: tid
required: false
remember: false
multiple: true
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
reduce: false
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
reduce_duplicates: false
type: select
limit: true
vid: test_exposed_checkboxes
hierarchy: false
error_message: true
plugin_id: taxonomy_index_tid
pager:
type: full
query:
options:
query_comment: ''
type: views_query
style:
type: default
row:
type: 'entity:node'
display_extenders: { }
display_plugin: default
display_title: Master
id: default
position: 0
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url
- url.query_args
- user
- 'user.node_grants:view'
tags: { }
page_1:
display_options:
path: test_exposed_form_checkboxes
display_extenders: { }
display_plugin: page
display_title: Page
id: page_1
position: 0
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url
- url.query_args
- user
- 'user.node_grants:view'
tags: { }

View file

@ -278,4 +278,3 @@ display:
plugin_id: standard
arguments: { }
display_extenders: { }

View file

@ -0,0 +1,187 @@
langcode: en
status: true
dependencies: { }
id: test_field_config_translation_filter
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: id
core: '8'
display:
default:
display_options:
access:
type: none
cache:
type: none
fields:
nid:
id: nid
field: nid
table: node_field_data
plugin_id: field
entity_type: node
entity_field: nid
langcode:
id: langcode
field: langcode
table: node_field_data
plugin_id: field
entity_type: node
entity_field: langcode
field_name_1:
id: field_name_1
table: node__field_name_1
field: field_name_1
plugin_id: field
entity_type: node
entity_field: field_name_1
field_name_2:
id: field_name_2
table: node__field_name_2
field: field_name_2
plugin_id: field
entity_type: node
entity_field: field_name_2
field_name_3:
id: field_name_3
table: node__field_name_3
field: field_name_3
plugin_id: field
entity_type: node
entity_field: field_name_3
sorts:
nid:
id: nid
table: node_field_data
field: nid
order: ASC
plugin_id: standard
entity_type: node
entity_field: nid
langcode:
id: langcode
table: node_field_data
field: langcode
relationship: none
group_type: group
admin_label: ''
order: ASC
exposed: false
expose:
label: ''
entity_type: node
entity_field: langcode
plugin_id: standard
style:
type: html_list
row:
type: fields
display_plugin: default
display_title: Master
id: default
position: 0
embed_1:
display_options:
defaults:
fields: true
filters: false
filters:
field_name_1_value:
id: field_name_1_value
table: node__field_name_1
field: field_name_1_value
value: 'field name 1: es'
plugin_id: string
entity_type: node
entity_field: field_name_1
display_plugin: embed
display_title: Embed 1
id: embed_1
position: 1
embed_2:
display_options:
defaults:
filters: false
filters:
field_name_1_value:
id: field_name_1_value
table: node__field_name_1
field: field_name_1_value
value: 'field name 1: fr'
plugin_id: string
entity_type: node
entity_field: field_name_1
display_plugin: embed
display_title: Embed 2
id: embed_2
position: 2
embed_3:
display_options:
defaults:
filters: false
filters:
field_name_2_value:
id: field_name_2_value
table: node__field_name_2
field: field_name_2_value
value: 'field name 2: es'
plugin_id: string
entity_type: node
entity_field: field_name_2
display_plugin: embed
display_title: Embed 3
id: embed_3
position: 3
embed_4:
display_options:
defaults:
filters: false
filters:
field_name_2_value:
id: field_name_2_value
table: node__field_name_2
field: field_name_2_value
value: 'field name 2: fr'
plugin_id: string
entity_type: node
entity_field: field_name_2
display_plugin: embed
display_title: Embed 4
id: embed_4
position: 4
embed_5:
display_options:
defaults:
filters: false
filters:
field_name_3_value:
id: field_name_3_value
table: node__field_name_3
field: field_name_3_value
value: 'field name 3: es'
plugin_id: string
entity_type: node
entity_field: field_name_3
display_plugin: embed
display_title: Embed 5
id: embed_5
position: 5
embed_6:
display_options:
defaults:
filters: false
filters:
field_name_3_value:
id: field_name_3_value
table: node__field_name_3
field: field_name_3_value
value: 'field name 3: fr'
plugin_id: string
entity_type: node
entity_field: field_name_3
display_plugin: embed
display_title: Embed 6
id: embed_6
position: 6

View file

@ -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: { }

View file

@ -0,0 +1,163 @@
langcode: en
status: true
dependencies:
module:
- node
id: test_latest_revision_filter
label: ''
module: views
description: ''
tag: ''
base_table: node_field_revision
base_field: vid
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: none
options:
offset: 0
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_revision
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: false
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:
latest_revision:
id: latest_revision
table: node_revision
field: latest_revision
relationship: none
group_type: group
admin_label: ''
operator: '='
value: ''
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
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
plugin_id: latest_revision
sorts: { }
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
show_admin_links: false
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- 'user.node_grants:view'
tags: { }

View file

@ -35,4 +35,3 @@ display:
display_options:
display_extenders: { }
path: test-menu-link

View file

@ -0,0 +1,71 @@
langcode: en
status: true
dependencies: { }
id: test_preprocess
label: ''
module: views
description: ''
tag: ''
base_table: entity_test
base_field: nid
core: '8'
display:
default:
display_options:
access:
type: none
cache:
type: tag
exposed_form:
type: basic
sorts:
id:
table: entity_test
id: id
field: id
plugin_id: standard
entity_type: entity_test
entity_field: id
order: desc
pager:
type: full
options:
items_per_page: 5
style:
type: default
row:
type: 'entity:entity_test'
css_class: 'entity-test__default'
display_plugin: default
display_title: Master
id: default
position: 0
display_2:
display_options:
access:
type: none
cache:
type: tag
exposed_form:
type: basic
sorts:
id:
table: entity_test
id: id
field: id
plugin_id: standard
entity_type: entity_test
entity_field: id
order: desc
pager:
type: full
options:
items_per_page: 5
style:
type: default
row:
type: 'entity:entity_test'
css_class: 'entity-test__default and_another-class'
display_plugin: default
display_title: Alternate
id: display_2

View file

@ -59,7 +59,6 @@ display:
type: string
settings:
link_to_entity: true
plugin_id: field
filters:
type:
id: type

View file

@ -0,0 +1,86 @@
langcode: en
status: true
dependencies: { }
id: test_view_sort_translation
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: id
core: '8'
display:
default:
display_options:
fields:
nid:
id: nid
field: nid
table: node_field_data
plugin_id: field
entity_type: node
entity_field: nid
langcode:
id: langcode
field: langcode
table: node_field_data
plugin_id: field
entity_type: node
entity_field: langcode
weight:
id: weight
table: node__weight
field: weight
plugin_id: numeric
entity_type: node
entity_field: weight
filters:
langcode:
id: langcode
table: node_field_data
field: langcode
relationship: none
group_type: group
admin_label: ''
operator: in
value:
'en': 'en'
group: 1
exposed: false
entity_type: node
entity_field: langcode
plugin_id: language
sorts:
weight:
id: weight
table: node__weight
field: weight_value
order: ASC
plugin_id: standard
entity_type: node
entity_field: weight
display_plugin: default
display_title: Master
id: default
position: 0
display_de:
display_plugin: embed
id: display_de
display_options:
defaults:
filters: false
filters:
langcode:
id: langcode
table: node_field_data
field: langcode
relationship: none
group_type: group
admin_label: ''
operator: in
value:
'de': 'de'
group: 1
exposed: false
entity_type: node
entity_field: langcode
plugin_id: language

View file

@ -5,4 +5,4 @@ package: Testing
version: VERSION
core: 8.x
dependencies:
- views
- drupal:views

View file

@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Simple form page callback to test the view element.
*
* @internal
*/
class ViewsTestDataElementEmbedForm extends FormBase {

View file

@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
/**
* Simple form page callback to test the view element.
*
* @internal
*/
class ViewsTestDataElementForm extends FormBase {

View file

@ -1,6 +1,7 @@
<?php
namespace Drupal\views_test_data\Plugin\views\argument_validator;
use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
/**
@ -36,6 +37,12 @@ class ArgumentValidatorTest extends ArgumentValidatorPluginBase {
* {@inheritdoc}
*/
public function validateArgument($arg) {
if ($arg === 'this value should be replaced') {
// Set the argument to a numeric value so this is valid on PostgeSQL for
// numeric fields.
$this->argument->argument = '1';
return TRUE;
}
return $arg == $this->options['test_value'];
}

View file

@ -68,7 +68,7 @@ class FieldFormButtonTest extends FieldPluginBase {
if (!empty($triggering_element['#test_button'])) {
$row_index = $triggering_element['#row_index'];
$view_args = !empty($this->view->args) ? implode(', ', $this->view->args) : $this->t('no arguments');
drupal_set_message($this->t('The test button at row @row_index for @view_id (@display) View with args: @args was submitted.', [
$this->messenger()->addStatus($this->t('The test button at row @row_index for @view_id (@display) View with args: @args was submitted.', [
'@display' => $this->view->current_display,
'@view_id' => $this->view->id(),
'@args' => $view_args,

View file

@ -35,7 +35,6 @@ class JoinTest extends JoinPluginBase {
$this->joinValue = $join_value;
}
/**
* {@inheritdoc}
*/

View file

@ -60,7 +60,7 @@ class QueryTest extends QueryPluginBase {
$this->conditions[] = [
'field' => $field,
'value' => $value,
'operator' => $operator
'operator' => $operator,
];
}
@ -74,7 +74,6 @@ class QueryTest extends QueryPluginBase {
$this->orderBy = ['field' => $field, 'order' => $order];
}
public function ensureTable($table, $relationship = NULL, JoinPluginBase $join = NULL) {
// There is no concept of joins.
}
@ -151,4 +150,9 @@ class QueryTest extends QueryPluginBase {
];
}
/**
* {@inheritdoc}
*/
public function setFieldTimezoneOffset(&$field, $offset) {}
}

View file

@ -20,9 +20,7 @@ use Drupal\views\Plugin\views\style\StylePluginBase;
class StyleTemplateTest extends StylePluginBase {
/**
* Can the style plugin use row plugins.
*
* @var bool
* {@inheritdoc}
*/
protected $usesRowPlugin = TRUE;

View file

@ -29,9 +29,7 @@ class StyleTest extends StylePluginBase {
public $output;
/**
* Can the style plugin use row plugins.
*
* @var bool
* {@inheritdoc}
*/
protected $usesRowPlugin = TRUE;

View file

@ -0,0 +1,8 @@
/**
* @file
* Just a placeholder file for the test.
*
* @see ViewsCacheTest::testHeaderStorage
*
* @ignore
*/

View file

@ -1,8 +1,6 @@
/**
* @file
* Just a placeholder file for the test.
*
* @see ViewsCacheTest::testHeaderStorage
*
* @ignore
*/
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/

View file

@ -5,4 +5,4 @@ package: Testing
version: VERSION
core: 8.x
dependencies:
- views
- drupal:views

View file

@ -29,7 +29,7 @@ function views_test_data_install() {
'p' => 'P',
'strong' => 'STRONG',
'em' => 'EM',
'marquee' => 'MARQUEE'
'marquee' => 'MARQUEE',
];
\Drupal::configFactory()->getEditable('views.settings')->set('field_rewrite_elements', $values)->save();
}

View file

@ -129,5 +129,5 @@ 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, FormStateInterface $form_state, $form_id) {
drupal_set_message(t('Test base form ID with Views forms and arguments.'));
\Drupal::messenger()->addStatus(t('Test base form ID with Views forms and arguments.'));
}

View file

@ -74,6 +74,11 @@ function views_test_data_placeholders() {
*/
function views_test_data_views_post_render(ViewExecutable $view, &$output, CachePluginBase $cache) {
\Drupal::state()->set('views_hook_test_views_post_render', TRUE);
if ($view->storage->id() === 'test_page_display' && $view->current_display === 'empty_row') {
for ($i = 0; $i < 5; $i++) {
$output['#rows'][0]['#rows'][] = [];
}
}
}
/**

View file

@ -5,4 +5,4 @@ package: Testing
version: VERSION
core: 8.x
dependencies:
- views
- drupal:views

View file

@ -5,5 +5,5 @@ package: Testing
version: VERSION
core: 8.x
dependencies:
- views
- language
- drupal:views
- drupal:language

View file

@ -0,0 +1,41 @@
<?php
namespace Drupal\views_test_modal\Controller;
use Drupal\Component\Serialization\Json;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Url;
class TestController extends ControllerBase {
/**
* Renders a link to open the /admin/content view in a modal dialog.
*/
public function modal() {
$build = [];
$build['open_admin_content'] = [
'#type' => 'link',
'#title' => $this->t('Administer content'),
'#url' => Url::fromUserInput('/admin/content'),
'#attributes' => [
'class' => ['use-ajax'],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'dialogClass' => 'views-test-modal',
'height' => '50%',
'width' => '50%',
'title' => $this->t('Administer content'),
]),
],
'#attached' => [
'library' => [
'core/drupal.dialog.ajax',
],
],
];
return $build;
}
}

View file

@ -0,0 +1,9 @@
name: 'Views Test Modal'
type: module
description: 'Provides a test page that renders a View in a modal.'
package: Testing
version: VERSION
core: 8.x
dependencies:
- drupal:node
- drupal:views

View file

@ -0,0 +1,6 @@
views_test_modal.modal:
path: '/views-test-modal/modal'
defaults:
_controller: '\Drupal\views_test_modal\Controller\TestController::modal'
requirements:
_access: 'TRUE'

View file

@ -4,15 +4,14 @@ namespace Drupal\Tests\views\Functional;
use Drupal\comment\CommentInterface;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Url;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\views\Views;
use Drupal\comment\Entity\Comment;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\taxonomy\Entity\Term;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
/**
* Tests the default views provided by views.
@ -53,7 +52,7 @@ class DefaultViewsTest extends ViewTestBase {
$vocabulary = Vocabulary::create([
'name' => $this->randomMachineName(),
'description' => $this->randomMachineName(),
'vid' => Unicode::strtolower($this->randomMachineName()),
'vid' => mb_strtolower($this->randomMachineName()),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
'help' => '',
'nodes' => ['page' => 'page'],
@ -62,7 +61,7 @@ class DefaultViewsTest extends ViewTestBase {
$vocabulary->save();
// Create a field.
$field_name = Unicode::strtolower($this->randomMachineName());
$field_name = mb_strtolower($this->randomMachineName());
$handler_settings = [
'target_bundles' => [
@ -97,9 +96,18 @@ class DefaultViewsTest extends ViewTestBase {
'status' => CommentInterface::PUBLISHED,
'entity_id' => $node->id(),
'entity_type' => 'node',
'field_name' => 'comment'
'field_name' => 'comment',
];
Comment::create($comment)->save();
$unpublished_comment = [
'uid' => $user->id(),
'status' => CommentInterface::NOT_PUBLISHED,
'entity_id' => $node->id(),
'entity_type' => 'node',
'field_name' => 'comment',
];
Comment::create($unpublished_comment)->save();
}
// Some views, such as the "Who's Online" view, only return results if at
@ -165,16 +173,19 @@ class DefaultViewsTest extends ViewTestBase {
// Create additional nodes compared to the one in the setup method.
// Create two nodes in the same month, and one in each following month.
$node = [
'created' => 280299600, // Sun, 19 Nov 1978 05:00:00 GMT
// Sun, 19 Nov 1978 05:00:00 GMT.
'created' => 280299600,
];
$this->drupalCreateNode($node);
$this->drupalCreateNode($node);
$node = [
'created' => 282891600, // Tue, 19 Dec 1978 05:00:00 GMT
// Tue, 19 Dec 1978 05:00:00 GMT.
'created' => 282891600,
];
$this->drupalCreateNode($node);
$node = [
'created' => 285570000, // Fri, 19 Jan 1979 05:00:00 GMT
// Fri, 19 Jan 1979 05:00:00 GMT.
'created' => 285570000,
];
$this->drupalCreateNode($node);

View file

@ -65,7 +65,7 @@ class FieldEntityTest extends ViewTestBase {
'uid' => $account->id(),
'entity_id' => $node->id(),
'entity_type' => 'node',
'field_name' => 'comment'
'field_name' => 'comment',
]);
$comment->save();

View file

@ -81,7 +81,7 @@ class FilterEntityBundleTest extends ViewTestBase {
'node.type.test_bundle_2',
],
'module' => [
'node'
'node',
],
];
$this->assertIdentical($expected, $view->getDependencies());

View file

@ -0,0 +1,160 @@
<?php
namespace Drupal\Tests\views\Functional\Entity;
use Drupal\node\Entity\Node;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\ViewExecutable;
use Drupal\views\Views;
/**
* Tests the 'Latest revision' filter.
*
* @group views
*/
class LatestRevisionFilterTest extends ViewTestBase {
/**
* An array of node revisions.
*
* @var \Drupal\node\NodeInterface[]
*/
protected $allRevisions = [];
/**
* An array of node revisions.
*
* @var \Drupal\node\NodeInterface[]
*/
protected $latestRevisions = [];
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = ['test_latest_revision_filter'];
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['node'];
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE) {
parent::setUp();
$this->drupalCreateContentType(['type' => 'article']);
// Create a node that goes through various default/pending revision stages.
$node = Node::create([
'title' => 'First node - v1 - default',
'type' => 'article',
]);
$node->save();
$this->allRevisions[$node->getRevisionId()] = $node;
$node->setTitle('First node - v2 - pending');
$node->setNewRevision(TRUE);
$node->isDefaultRevision(FALSE);
$node->save();
$this->allRevisions[$node->getRevisionId()] = $node;
$node->setTitle('First node - v3 - default');
$node->setNewRevision(TRUE);
$node->isDefaultRevision(TRUE);
$node->save();
$this->allRevisions[$node->getRevisionId()] = $node;
$node->setTitle('First node - v4 - pending');
$node->setNewRevision(TRUE);
$node->isDefaultRevision(TRUE);
$node->save();
$this->allRevisions[$node->getRevisionId()] = $node;
$this->latestRevisions[$node->getRevisionId()] = $node;
// Create a node that has a default and a pending revision.
$node = Node::create([
'title' => 'Second node - v1 - default',
'type' => 'article',
]);
$node->save();
$this->allRevisions[$node->getRevisionId()] = $node;
$node->setTitle('Second node - v2 - pending');
$node->setNewRevision(TRUE);
$node->isDefaultRevision(FALSE);
$node->save();
$this->allRevisions[$node->getRevisionId()] = $node;
$this->latestRevisions[$node->getRevisionId()] = $node;
// Create a node that only has a default revision.
$node = Node::create([
'title' => 'Third node - v1 - default',
'type' => 'article',
]);
$node->save();
$this->allRevisions[$node->getRevisionId()] = $node;
$this->latestRevisions[$node->getRevisionId()] = $node;
// Create a node that only has a pending revision.
$node = Node::create([
'title' => 'Fourth node - v1 - pending',
'type' => 'article',
]);
$node->isDefaultRevision(FALSE);
$node->save();
$this->allRevisions[$node->getRevisionId()] = $node;
$this->latestRevisions[$node->getRevisionId()] = $node;
}
/**
* Tests the 'Latest revision' filter.
*/
public function testLatestRevisionFilter() {
$view = Views::getView('test_latest_revision_filter');
$this->executeView($view);
// Check that we have all the results.
$this->assertCount(count($this->latestRevisions), $view->result);
$expected = $not_expected = [];
foreach ($this->allRevisions as $revision_id => $revision) {
if (isset($this->latestRevisions[$revision_id])) {
$expected[] = [
'vid' => $revision_id,
'title' => $revision->label(),
];
}
else {
$not_expected[] = $revision_id;
}
}
$this->assertIdenticalResultset($view, $expected, ['vid' => 'vid', 'title' => 'title'], 'The test view only shows the latest revisions.');
$this->assertNotInResultSet($view, $not_expected, 'Non-latest revisions are not shown by the view.');
$view->destroy();
}
/**
* Verifies that a list of revision IDs are not in the result.
*
* @param \Drupal\views\ViewExecutable $view
* An executed View.
* @param array $not_expected_revision_ids
* An array of revision IDs which should not be part of the result set.
* @param string $message
* (optional) A custom message to display with the assertion.
*/
protected function assertNotInResultSet(ViewExecutable $view, array $not_expected_revision_ids, $message = '') {
$found_revision_ids = array_filter($view->result, function ($row) use ($not_expected_revision_ids) {
return in_array($row->vid, $not_expected_revision_ids);
});
$this->assertFalse($found_revision_ids, $message);
}
}

View file

@ -0,0 +1,379 @@
<?php
namespace Drupal\Tests\views\Functional;
use Drupal\Component\Render\MarkupInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\language\Entity\ContentLanguageSettings;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\field\Functional\Views\FieldTestBase;
use Drupal\views\Views;
/**
* Tests the Field Views data.
*
* @group views
*/
class FieldApiDataTest extends FieldTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['language'];
/**
* {@inheritdoc}
*/
public static $testViews = ['test_field_config_translation_filter'];
/**
* The nodes used by the translation filter tests.
*
* @var \Drupal\node\NodeInterface[]
*/
protected $translationNodes;
protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views);
$field_names = $this->setUpFieldStorages(4);
// Attach the field to nodes only.
$field = [
'field_name' => $field_names[0],
'entity_type' => 'node',
'bundle' => 'page',
'label' => 'GiraffeA" label',
];
FieldConfig::create($field)->save();
// Attach the same field to a different bundle with a different label.
$this->drupalCreateContentType(['type' => 'article']);
FieldConfig::create([
'field_name' => $field_names[0],
'entity_type' => 'node',
'bundle' => 'article',
'label' => 'GiraffeB" label',
])->save();
// Now create some example nodes/users for the view result.
for ($i = 0; $i < 5; $i++) {
$edit = [
$field_names[0] => [(['value' => $this->randomMachineName()])],
];
$nodes[] = $this->drupalCreateNode($edit);
}
$bundles = [];
$bundles[] = $bundle = NodeType::create(['type' => 'bundle1']);
$bundle->save();
$bundles[] = $bundle = NodeType::create(['type' => 'bundle2']);
$bundle->save();
// Make the first field translatable on all bundles.
$field = FieldConfig::create([
'field_name' => $field_names[1],
'entity_type' => 'node',
'bundle' => $bundles[0]->id(),
'translatable' => TRUE,
]);
$field->save();
$field = FieldConfig::create([
'field_name' => $field_names[1],
'entity_type' => 'node',
'bundle' => $bundles[1]->id(),
'translatable' => TRUE,
]);
$field->save();
// Make the second field not translatable on any bundle.
$field = FieldConfig::create([
'field_name' => $field_names[2],
'entity_type' => 'node',
'bundle' => $bundles[0]->id(),
'translatable' => FALSE,
]);
$field->save();
$field = FieldConfig::create([
'field_name' => $field_names[2],
'entity_type' => 'node',
'bundle' => $bundles[1]->id(),
'translatable' => FALSE,
]);
$field->save();
// Make the last field translatable on some bundles.
$field = FieldConfig::create([
'field_name' => $field_names[3],
'entity_type' => 'node',
'bundle' => $bundles[0]->id(),
'translatable' => TRUE,
]);
$field->save();
$field = FieldConfig::create([
'field_name' => $field_names[3],
'entity_type' => 'node',
'bundle' => $bundles[1]->id(),
'translatable' => FALSE,
]);
$field->save();
// Create some example content.
ConfigurableLanguage::create([
'id' => 'es',
])->save();
ConfigurableLanguage::create([
'id' => 'fr',
])->save();
$config = ContentLanguageSettings::loadByEntityTypeBundle('node', $bundles[0]->id());
$config->setDefaultLangcode('es')
->setLanguageAlterable(TRUE)
->save();
$config = ContentLanguageSettings::loadByEntityTypeBundle('node', $bundles[1]->id());
$config->setDefaultLangcode('es')
->setLanguageAlterable(TRUE)
->save();
$node = Node::create([
'title' => 'Test title ' . $bundles[0]->id(),
'type' => $bundles[0]->id(),
'langcode' => 'es',
$field_names[1] => 'field name 1: es',
$field_names[2] => 'field name 2: es',
$field_names[3] => 'field name 3: es',
]);
$node->save();
$this->translationNodes[] = $node;
$translation = $node->addTranslation('fr');
$translation->{$field_names[1]}->value = 'field name 1: fr';
$translation->{$field_names[3]}->value = 'field name 3: fr';
$translation->title->value = $node->title->value;
$translation->save();
$node = Node::create([
'title' => 'Test title ' . $bundles[1]->id(),
'type' => $bundles[1]->id(),
'langcode' => 'es',
$field_names[1] => 'field name 1: es',
$field_names[2] => 'field name 2: es',
$field_names[3] => 'field name 3: es',
]);
$node->save();
$this->translationNodes[] = $node;
$translation = $node->addTranslation('fr');
$translation->{$field_names[1]}->value = 'field name 1: fr';
$translation->title->value = $node->title->value;
$translation->save();
}
/**
* Unit testing the views data structure.
*
* We check data structure for both node and node revision tables.
*/
public function testViewsData() {
$table_mapping = \Drupal::entityManager()->getStorage('node')->getTableMapping();
$field_storage = $this->fieldStorages[0];
$current_table = $table_mapping->getDedicatedDataTableName($field_storage);
$revision_table = $table_mapping->getDedicatedRevisionTableName($field_storage);
$data = $this->getViewsData();
$this->assertTrue(isset($data[$current_table]));
$this->assertTrue(isset($data[$revision_table]));
// The node field should join against node_field_data.
$this->assertTrue(isset($data[$current_table]['table']['join']['node_field_data']));
$this->assertTrue(isset($data[$revision_table]['table']['join']['node_field_revision']));
$expected_join = [
'table' => $current_table,
'left_field' => 'nid',
'field' => 'entity_id',
'extra' => [
['field' => 'deleted', 'value' => 0, 'numeric' => TRUE],
['left_field' => 'langcode', 'field' => 'langcode'],
],
];
$this->assertEqual($expected_join, $data[$current_table]['table']['join']['node_field_data']);
$expected_join = [
'table' => $revision_table,
'left_field' => 'vid',
'field' => 'revision_id',
'extra' => [
['field' => 'deleted', 'value' => 0, 'numeric' => TRUE],
['left_field' => 'langcode', 'field' => 'langcode'],
],
];
$this->assertEqual($expected_join, $data[$revision_table]['table']['join']['node_field_revision']);
// Test click sortable.
$this->assertTrue($data[$current_table][$field_storage->getName()]['field']['click sortable'], 'String field is click sortable.');
// Click sort should only be on the primary field.
$this->assertTrue(empty($data[$revision_table][$field_storage->getName()]['field']['click sortable']), 'Non-primary fields are not click sortable');
$this->assertTrue($data[$current_table][$field_storage->getName()]['help'] instanceof MarkupInterface);
$this->assertEqual($data[$current_table][$field_storage->getName()]['help'], 'Appears in: page, article. Also known as: Content: GiraffeB&quot; label');
$this->assertTrue($data[$current_table][$field_storage->getName() . '_value']['help'] instanceof MarkupInterface);
$this->assertEqual($data[$current_table][$field_storage->getName() . '_value']['help'], 'Appears in: page, article. Also known as: Content: GiraffeA&quot; label (field_name_0)');
// Since each label is only used once, views_entity_field_label() will
// return a label using alphabetical sorting.
$this->assertEqual('GiraffeA&quot; label (field_name_0)', $data[$current_table][$field_storage->getName() . '_value']['title']);
// Attach the same field to a different bundle with a different label.
$this->drupalCreateContentType(['type' => 'news']);
FieldConfig::create([
'field_name' => $this->fieldStorages[0]->getName(),
'entity_type' => 'node',
'bundle' => 'news',
'label' => 'GiraffeB" label',
])->save();
$this->container->get('views.views_data')->clear();
$data = $this->getViewsData();
// Now the 'GiraffeB&quot; label' is used twice and therefore will be
// selected by views_entity_field_label().
$this->assertEqual('GiraffeB&quot; label (field_name_0)', $data[$current_table][$field_storage->getName() . '_value']['title']);
$this->assertTrue($data[$current_table][$field_storage->getName()]['help'] instanceof MarkupInterface);
$this->assertEqual($data[$current_table][$field_storage->getName()]['help'], 'Appears in: page, article, news. Also known as: Content: GiraffeA&quot; label');
}
/**
* Gets the views data for the field created in setUp().
*
* @return array
*/
protected function getViewsData() {
$views_data = $this->container->get('views.views_data');
$data = [];
// Check the table and the joins of the first field.
// Attached to node only.
/** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
$table_mapping = \Drupal::entityManager()->getStorage('node')->getTableMapping();
$current_table = $table_mapping->getDedicatedDataTableName($this->fieldStorages[0]);
$revision_table = $table_mapping->getDedicatedRevisionTableName($this->fieldStorages[0]);
$data[$current_table] = $views_data->get($current_table);
$data[$revision_table] = $views_data->get($revision_table);
return $data;
}
/**
* Tests filtering entries with different translatability.
*/
public function testEntityFieldFilter() {
$map = [
'nid' => 'nid',
'langcode' => 'langcode',
];
$view = Views::getView('test_field_config_translation_filter');
// Filter by 'field name 1: es'.
$view->setDisplay('embed_1');
$this->executeView($view);
$expected = [
[
'nid' => $this->translationNodes[0]->id(),
'langcode' => 'es',
],
[
'nid' => $this->translationNodes[1]->id(),
'langcode' => 'es',
],
];
$this->assertIdenticalResultset($view, $expected, $map);
$view->destroy();
// Filter by 'field name 1: fr'.
$view->setDisplay('embed_2');
$this->executeView($view);
$expected = [
[
'nid' => $this->translationNodes[0]->id(),
'langcode' => 'fr',
],
[
'nid' => $this->translationNodes[1]->id(),
'langcode' => 'fr',
],
];
$this->assertIdenticalResultset($view, $expected, $map);
$view->destroy();
// Filter by 'field name 2: es'.
$view->setDisplay('embed_3');
$this->executeView($view);
$expected = [
[
'nid' => $this->translationNodes[0]->id(),
'langcode' => 'es',
],
[
'nid' => $this->translationNodes[0]->id(),
'langcode' => 'fr',
],
[
'nid' => $this->translationNodes[1]->id(),
'langcode' => 'es',
],
[
'nid' => $this->translationNodes[1]->id(),
'langcode' => 'fr',
],
];
$this->assertIdenticalResultset($view, $expected, $map);
$view->destroy();
// Filter by 'field name 2: fr', which doesn't exist.
$view->setDisplay('embed_4');
$this->executeView($view);
$expected = [];
$this->assertIdenticalResultset($view, $expected, $map);
$view->destroy();
// Filter by 'field name 3: es'.
$view->setDisplay('embed_5');
$this->executeView($view);
$expected = [
[
'nid' => $this->translationNodes[0]->id(),
'langcode' => 'es',
],
[
'nid' => $this->translationNodes[1]->id(),
'langcode' => 'es',
],
// Why is this one returned?
[
'nid' => $this->translationNodes[1]->id(),
'langcode' => 'fr',
],
];
$this->assertIdenticalResultset($view, $expected, $map);
$view->destroy();
// Filter by 'field name 3: fr'.
$view->setDisplay('embed_6');
$this->executeView($view);
$expected = [
[
'nid' => $this->translationNodes[0]->id(),
'langcode' => 'fr',
],
];
$this->assertIdenticalResultset($view, $expected, $map);
$view->destroy();
}
}

View file

@ -2,7 +2,6 @@
namespace Drupal\Tests\views\Functional;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Url;
use Drupal\views\Tests\AssertViewsCacheTagsTrait;
@ -41,7 +40,7 @@ class GlossaryTest extends ViewTestBase {
$nodes_by_char = [];
foreach ($nodes_per_char as $char => $count) {
$setting = [
'type' => $type->id()
'type' => $type->id(),
];
for ($i = 0; $i < $count; $i++) {
$node = $setting;
@ -109,7 +108,7 @@ class GlossaryTest extends ViewTestBase {
$this->assertResponse(200);
foreach ($nodes_per_char as $char => $count) {
$href = Url::fromRoute('view.glossary.page_1', ['arg_0' => $char])->toString();
$label = Unicode::strtoupper($char);
$label = mb_strtoupper($char);
// Get the summary link for a certain character. Filter by label and href
// to ensure that both of them are correct.
$result = $this->xpath('//a[contains(@href, :href) and normalize-space(text())=:label]/..', [':href' => $href, ':label' => $label]);

View file

@ -0,0 +1,30 @@
<?php
namespace Drupal\Tests\views\Functional\Hal;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
use Drupal\Tests\views\Functional\Rest\ViewResourceTestBase;
/**
* @group hal
*/
class ViewHalJsonAnonTest extends ViewResourceTestBase {
use AnonResourceTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = ['hal'];
/**
* {@inheritdoc}
*/
protected static $format = 'hal_json';
/**
* {@inheritdoc}
*/
protected static $mimeType = 'application/hal+json';
}

View file

@ -0,0 +1,35 @@
<?php
namespace Drupal\Tests\views\Functional\Hal;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
use Drupal\Tests\views\Functional\Rest\ViewResourceTestBase;
/**
* @group hal
*/
class ViewHalJsonBasicAuthTest extends ViewResourceTestBase {
use BasicAuthResourceTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = ['hal', 'basic_auth'];
/**
* {@inheritdoc}
*/
protected static $format = 'hal_json';
/**
* {@inheritdoc}
*/
protected static $mimeType = 'application/hal+json';
/**
* {@inheritdoc}
*/
protected static $auth = 'basic_auth';
}

View file

@ -0,0 +1,35 @@
<?php
namespace Drupal\Tests\views\Functional\Hal;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
use Drupal\Tests\views\Functional\Rest\ViewResourceTestBase;
/**
* @group hal
*/
class ViewHalJsonCookieTest extends ViewResourceTestBase {
use CookieResourceTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = ['hal'];
/**
* {@inheritdoc}
*/
protected static $format = 'hal_json';
/**
* {@inheritdoc}
*/
protected static $mimeType = 'application/hal+json';
/**
* {@inheritdoc}
*/
protected static $auth = 'cookie';
}

View file

@ -41,14 +41,13 @@ class AreaTest extends ViewTestBase {
'title' => 'Test Example area',
'help' => 'A area handler which just exists for tests.',
'area' => [
'id' => 'test_example'
]
'id' => 'test_example',
],
];
return $data;
}
/**
* Tests the generic UI of a area handler.
*/

View file

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

View file

@ -3,11 +3,10 @@
namespace Drupal\Tests\views\Functional\Handler;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Render\RenderContext;
use Drupal\Core\Url;
use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Views;
@ -340,7 +339,7 @@ class FieldWebTest extends ViewTestBase {
$this->assertSubString($output, UrlHelper::encodePath('Drupal Has A Great Community'));
unset($id_field->options['alter']['path_case']);
// Tests the linkclass setting and see whether it actually exists in the
// Tests the link_class setting and see whether it actually exists in the
// output.
$id_field->options['alter']['link_class'] = $class = $this->randomMachineName();
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($id_field, $row) {
@ -484,7 +483,7 @@ class FieldWebTest extends ViewTestBase {
'p',
'strong',
'em',
'marquee'
'marquee',
];
$this->assertEqual(array_keys($element_types), $expected_elements);
@ -556,7 +555,7 @@ class FieldWebTest extends ViewTestBase {
// Tests for simple trimming by string length.
$row->views_test_data_name = $this->randomMachineName(8);
$name_field->options['alter']['max_length'] = 5;
$trimmed_name = Unicode::substr($row->views_test_data_name, 0, 5);
$trimmed_name = mb_substr($row->views_test_data_name, 0, 5);
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($name_field, $row) {
return $name_field->advancedRender($row);
@ -581,28 +580,28 @@ class FieldWebTest extends ViewTestBase {
[
'value' => $random_text_8,
'trimmed_value' => '',
'trimmed' => TRUE
'trimmed' => TRUE,
],
// Create one string with two words which doesn't fit both into the limit.
[
'value' => $random_text_8 . ' ' . $random_text_8,
'trimmed_value' => '',
'trimmed' => TRUE
'trimmed' => TRUE,
],
// Create one string which contains of two words, of which only the first
// fits into the limit.
[
'value' => $random_text_4 . ' ' . $random_text_8,
'trimmed_value' => $random_text_4,
'trimmed' => TRUE
'trimmed' => TRUE,
],
// Create one string which contains of two words, of which both fits into
// the limit.
[
'value' => $random_text_2 . ' ' . $random_text_2,
'trimmed_value' => $random_text_2 . ' ' . $random_text_2,
'trimmed' => FALSE
]
'trimmed' => FALSE,
],
];
foreach ($tuples as $tuple) {

View file

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

View file

@ -25,7 +25,7 @@ class AccessTest extends ViewTestBase {
/**
* Modules to enable.
*
* @return array
* @var array
*/
public static $modules = ['node'];

View file

@ -10,7 +10,6 @@ use Drupal\views\Views;
use Drupal\views_test_data\Plugin\views\argument_default\ArgumentDefaultTest as ArgumentDefaultTestPlugin;
use Symfony\Component\HttpFoundation\Request;
/**
* Tests pluggable argument_default for views.
*
@ -56,9 +55,9 @@ class ArgumentDefaultTest extends ViewTestBase {
$options = [
'default_argument_type' => 'argument_default_test',
'default_argument_options' => [
'value' => 'John'
'value' => 'John',
],
'default_action' => 'default'
'default_action' => 'default',
];
$id = $view->addHandler('default', 'argument', 'views_test_data', 'name', $options);
$view->initHandlers();
@ -82,7 +81,6 @@ class ArgumentDefaultTest extends ViewTestBase {
$this->assertIdenticalResultset($view, $expected_result, ['views_test_data_name' => 'name']);
}
/**
* Tests the use of a default argument plugin that provides no options.
*/
@ -131,7 +129,7 @@ class ArgumentDefaultTest extends ViewTestBase {
/**
* @todo Test php default argument.
*/
//function testArgumentDefaultPhp() {}
// function testArgumentDefaultPhp() {}
/**
* Test node default argument.

View file

@ -2,7 +2,7 @@
namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Views;
@ -51,8 +51,8 @@ class CacheWebTest extends ViewTestBase {
'type' => 'time',
'options' => [
'results_lifespan' => '3600',
'output_lifespan' => '3600'
]
'output_lifespan' => '3600',
],
]);
$view->save();
$this->container->get('router.builder')->rebuildIfNeeded();
@ -70,7 +70,7 @@ class CacheWebTest extends ViewTestBase {
'config:user.role.anonymous',
'config:views.view.test_display',
'node_list',
'rendered'
'rendered',
];
$this->assertCacheTags($cache_tags);

View file

@ -3,9 +3,9 @@
namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\Core\Plugin\Context\ContextDefinitionInterface;
use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
/**
* A test for contextual filters exposed as block context.
@ -110,7 +110,7 @@ class ContextualFiltersBlockContextTest extends ViewTestBase {
'label_display' => 'visible',
'views_label' => '',
'items_per_page' => 'none',
'context_mapping' => ['nid' => '@node.node_route_context:node']
'context_mapping' => ['nid' => '@node.node_route_context:node'],
];
$this->assertEqual($block->getPlugin()->getConfiguration(), $expected_settings, 'Block settings are correct.');

View file

@ -36,7 +36,6 @@ class DisplayAttachmentTest extends ViewTestBase {
$this->drupalLogin($admin_user);
}
/**
* Tests the attachment plugin.
*/

View file

@ -5,7 +5,7 @@ namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Views;
@ -125,6 +125,10 @@ class DisplayEntityReferenceTest extends ViewTestBase {
* Tests the entity reference display plugin.
*/
public function testEntityReferenceDisplay() {
// Test that the 'title' settings are not shown.
$this->drupalGet('admin/structure/views/view/test_display_entity_reference/edit/entity_reference_1');
$this->assertSession()->linkByHrefNotExists('admin/structure/views/nojs/display/test_display_entity_reference/entity_reference_1/title');
// Add the new field to the fields.
$this->drupalPostForm('admin/structure/views/nojs/add-handler/test_display_entity_reference/default/field', ['name[entity_test__' . $this->fieldName . '.' . $this->fieldName . ']' => TRUE], t('Add and configure fields'));
$this->drupalPostForm(NULL, [], t('Apply'));
@ -209,7 +213,7 @@ class DisplayEntityReferenceTest extends ViewTestBase {
$this->drupalPostForm('admin/structure/views/nojs/display/test_display_entity_reference/entity_reference_1/style_options', ['style_options[search_fields][uid]' => 'uid'], t('Apply'));
$this->drupalPostForm(NULL, [], t('Save'));
// Test that the search still works with the ralated field.
// Test that the search still works with the related field.
$view = Views::getView('test_display_entity_reference');
$view->setDisplay('entity_reference_1');
@ -249,6 +253,12 @@ class DisplayEntityReferenceTest extends ViewTestBase {
$this->executeView($view);
$this->assertEqual(count($view->result), 2, 'Search returned two rows');
// Test that the render() return empty array for empty result.
$view = Views::getView('test_display_entity_reference');
$view->setDisplay('entity_reference_1');
$render = $view->display_handler->render();
$this->assertSame([], $render, 'Render returned empty array');
}
}

View file

@ -0,0 +1,174 @@
<?php
namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Views;
/**
* Tests the feed display plugin.
*
* @group views
* @see \Drupal\views\Plugin\views\display\Feed
*/
class DisplayFeedTest extends ViewTestBase {
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = ['test_display_feed', 'test_attached_disabled', 'test_feed_icon'];
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['block', 'node', 'views'];
protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views);
$this->enableViewsTestModule();
$admin_user = $this->drupalCreateUser(['administer site configuration']);
$this->drupalLogin($admin_user);
}
/**
* Tests the rendered output.
*/
public function testFeedOutput() {
$this->drupalCreateContentType(['type' => 'page']);
// Verify a title with HTML entities is properly escaped.
$node_title = 'This "cool" & "neat" article\'s title';
$node = $this->drupalCreateNode([
'title' => $node_title,
'body' => [
0 => [
'value' => 'A paragraph',
'format' => filter_default_format(),
],
],
]);
// Test the site name setting.
$site_name = $this->randomMachineName();
$this->config('system.site')->set('name', $site_name)->save();
$this->drupalGet('test-feed-display.xml');
$this->assertEquals($site_name, $this->getSession()->getDriver()->getText('//title'));
$this->assertEquals($node_title, $this->getSession()->getDriver()->getText('//item/title'));
// Verify HTML is properly escaped in the description field.
$this->assertRaw('&lt;p&gt;A paragraph&lt;/p&gt;');
$view = $this->container->get('entity.manager')->getStorage('view')->load('test_display_feed');
$display = &$view->getDisplay('feed_1');
$display['display_options']['sitename_title'] = 0;
$view->save();
$this->drupalGet('test-feed-display.xml');
$this->assertEquals('test_display_feed', $this->getSession()->getDriver()->getText('//title'));
// Add a block display and attach the feed.
$view->getExecutable()->newDisplay('block', NULL, 'test');
$display = &$view->getDisplay('feed_1');
$display['display_options']['displays']['test'] = 'test';
$view->save();
// Test the feed display adds a feed icon to the block display.
$this->drupalPlaceBlock('views_block:test_display_feed-test');
$this->drupalGet('<front>');
$feed_icon = $this->cssSelect('div.view-id-test_display_feed a.feed-icon');
$this->assertTrue(strpos($feed_icon[0]->getAttribute('href'), 'test-feed-display.xml'), 'The feed icon was found.');
// Test feed display attached to page display with arguments.
$this->drupalGet('test-feed-icon/' . $node->id());
$page_url = $this->getUrl();
$icon_href = $this->cssSelect('a.feed-icon[href *= "test-feed-icon"]')[0]->getAttribute('href');
$this->assertEqual($icon_href, $page_url . '/feed', 'The feed icon was found.');
$link_href = $this->cssSelect('link[type = "application/rss+xml"][href *= "test-feed-icon"]')[0]->getAttribute('href');
$this->assertEqual($link_href, $page_url . '/feed', 'The RSS link was found.');
$feed_link = simplexml_load_string($this->drupalGet($icon_href))->channel->link;
$this->assertEqual($feed_link, $page_url, 'The channel link was found.');
}
/**
* Tests the rendered output for fields display.
*/
public function testFeedFieldOutput() {
$this->drupalCreateContentType(['type' => 'page']);
// Verify a title with HTML entities is properly escaped.
$node_title = 'This "cool" & "neat" article\'s title';
$this->drupalCreateNode([
'title' => $node_title,
'body' => [
0 => [
'value' => 'A paragraph',
'format' => filter_default_format(),
],
],
]);
$this->drupalGet('test-feed-display-fields.xml');
$this->assertEquals($node_title, $this->getSession()->getDriver()->getText('//title/a'));
// Verify HTML is properly escaped in the description field.
$this->assertRaw('&lt;p&gt;A paragraph&lt;/p&gt;');
}
/**
* Tests that nothing is output when the feed display is disabled.
*/
public function testDisabledFeed() {
$this->drupalCreateContentType(['type' => 'page']);
$this->drupalCreateNode();
// Ensure that the feed_1 display is attached to the page_1 display.
$view = Views::getView('test_attached_disabled');
$view->setDisplay('page_1');
$attached_displays = $view->display_handler->getAttachedDisplays();
$this->assertTrue(in_array('feed_1', $attached_displays), 'The feed display is attached to the page display.');
// Check that the rss header is output on the page display.
$this->drupalGet('/test-attached-disabled');
$feed_header = $this->xpath('//link[@rel="alternate"]');
$this->assertEqual($feed_header[0]->getAttribute('type'), 'application/rss+xml', 'The feed link has the type application/rss+xml.');
$this->assertTrue(strpos($feed_header[0]->getAttribute('href'), 'test-attached-disabled.xml'), 'Page display contains the correct feed URL.');
// Disable the feed display.
$view->displayHandlers->get('feed_1')->setOption('enabled', FALSE);
$view->save();
// Ensure there is no link rel present on the page.
$this->drupalGet('/test-attached-disabled');
$result = $this->xpath('//link[@rel="alternate"]');
$this->assertTrue(empty($result), 'Page display does not contain a feed header.');
// Ensure the feed attachment returns 'Not found'.
$this->drupalGet('/test-attached-disabled.xml');
$this->assertResponse(404);
}
/**
* Tests that the feed display works when the linked display is disabled.
*/
public function testDisabledLinkedDisplay() {
$view = Views::getView('test_attached_disabled');
$view->setDisplay();
// Disable the page and link the feed to the page.
$view->displayHandlers->get('feed_1')->setOption('link_display', 'page_1');
$view->displayHandlers->get('page_1')->setOption('enabled', FALSE);
$view->save();
\Drupal::service('router.builder')->rebuild();
$this->drupalGet('test-attached-disabled');
$this->assertResponse(404);
// Ensure the feed can still be reached.
$this->drupalGet('test-attached-disabled.xml');
$this->assertResponse(200);
}
}

View file

@ -2,7 +2,7 @@
namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Views;

View file

@ -285,7 +285,7 @@ class DisplayTest extends ViewTestBase {
'table' => 'views_test_data',
'field' => 'id',
'id' => 'id',
'value' => ['value' => 7297]
'value' => ['value' => 7297],
];
$view->setHandler('default', 'filter', 'id', $item);
$this->executeView($view);

View file

@ -0,0 +1,167 @@
<?php
namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Views;
/**
* Tests exposed forms functionality.
*
* @group views
*/
class ExposedFormCheckboxesTest extends ViewTestBase {
use EntityReferenceTestTrait;
/**
* {@inheritdoc}
*/
public static $testViews = ['test_exposed_form_checkboxes'];
/**
* {@inheritdoc}
*/
public static $modules = ['node', 'views_ui', 'taxonomy'];
/**
* Test terms.
*
* @var array
*/
public $terms = [];
/**
* Vocabulary for testing checkbox options.
*
* @var \Drupal\taxonomy\Entity\Vocabulary
*/
public $vocabulary;
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE) {
parent::setUp(FALSE);
// Create a vocabulary and entity reference field so we can test the "is all
// of" filter operator. Must be done ahead of the view import so the
// vocabulary is in place to meet the view dependencies.
$vocabulary = Vocabulary::create([
'name' => 'test_exposed_checkboxes',
'vid' => 'test_exposed_checkboxes',
'nodes' => ['article' => 'article'],
]);
$vocabulary->save();
$this->vocabulary = $vocabulary;
ViewTestData::createTestViews(self::class, ['views_test_config']);
$this->enableViewsTestModule();
// Create two content types.
$this->drupalCreateContentType(['type' => 'article']);
$this->drupalCreateContentType(['type' => 'page']);
// Create some random nodes: 5 articles, one page.
for ($i = 0; $i < 5; $i++) {
$this->drupalCreateNode(['type' => 'article']);
}
$this->drupalCreateNode(['type' => 'page']);
}
/**
* Tests overriding the default render option with checkboxes.
*/
public function testExposedFormRenderCheckboxes() {
// Use a test theme to convert multi-select elements into checkboxes.
\Drupal::service('theme_handler')->install(['views_test_checkboxes_theme']);
$this->config('system.theme')
->set('default', 'views_test_checkboxes_theme')
->save();
// Only display 5 items per page so we can test that paging works.
$view = Views::getView('test_exposed_form_checkboxes');
$display = &$view->storage->getDisplay('default');
$display['display_options']['pager']['options']['items_per_page'] = 5;
$view->save();
$this->drupalGet('test_exposed_form_checkboxes');
$actual = $this->xpath('//form//input[@type="checkbox" and @name="type[article]"]');
$this->assertEqual(count($actual), 1, 'Article option renders as a checkbox.');
$actual = $this->xpath('//form//input[@type="checkbox" and @name="type[page]"]');
$this->assertEqual(count($actual), 1, 'Page option renders as a checkbox');
// Ensure that all results are displayed.
$rows = $this->xpath("//div[contains(@class, 'views-row')]");
$this->assertEqual(count($rows), 5, '5 rows are displayed by default on the first page when no options are checked.');
$this->clickLink('Page 2');
$rows = $this->xpath("//div[contains(@class, 'views-row')]");
$this->assertEqual(count($rows), 1, '1 row is displayed by default on the second page when no options are checked.');
$this->assertNoText('An illegal choice has been detected. Please contact the site administrator.');
}
/**
* Tests that "is all of" filters work with checkboxes.
*/
public function testExposedIsAllOfFilter() {
foreach (['Term 1', 'Term 2', 'Term 3'] as $term_name) {
// Add a few terms to the new vocabulary.
$term = Term::create([
'name' => $term_name,
'vid' => $this->vocabulary->id(),
]);
$term->save();
$this->terms[] = $term;
}
// Create a field.
$field_name = mb_strtolower($this->randomMachineName());
$handler_settings = [
'target_bundles' => [
$this->vocabulary->id() => $this->vocabulary->id(),
],
'auto_create' => FALSE,
];
$this->createEntityReferenceField('node', 'article', $field_name, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
// Add some test nodes.
$this->createNode([
'type' => 'article',
$field_name => [$this->terms[0]->id(), $this->terms[1]->id()],
]);
$this->createNode([
'type' => 'article',
$field_name => [$this->terms[0]->id(), $this->terms[2]->id()],
]);
// Use a test theme to convert multi-select elements into checkboxes.
\Drupal::service('theme_handler')->install(['views_test_checkboxes_theme']);
$this->config('system.theme')
->set('default', 'views_test_checkboxes_theme')
->save();
$this->drupalGet('test_exposed_form_checkboxes');
// Ensure that all results are displayed.
$rows = $this->xpath("//div[contains(@class, 'views-row')]");
$this->assertEqual(count($rows), 8, 'All rows are displayed by default on the first page when no options are checked.');
$this->assertNoText('An illegal choice has been detected. Please contact the site administrator.');
// Select one option and ensure we still have results.
$tid = $this->terms[0]->id();
$this->drupalPostForm(NULL, ["tid[$tid]" => $tid], t('Apply'));
// Ensure only nodes tagged with $tid are displayed.
$rows = $this->xpath("//div[contains(@class, 'views-row')]");
$this->assertEqual(count($rows), 2, 'Correct rows are displayed when a tid is selected.');
$this->assertNoText('An illegal choice has been detected. Please contact the site administrator.');
}
}

View file

@ -4,7 +4,7 @@ namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\Component\Utility\Html;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\ViewExecutable;
use Drupal\views\Views;
@ -104,9 +104,9 @@ class ExposedFormTest extends ViewTestBase {
'label' => 'Content: Type',
'operator_id' => 'type_op',
'reduce' => FALSE,
'description' => 'Exposed overridden description'
'description' => 'Exposed overridden description',
],
]
],
]);
$view->save();
$this->drupalGet('test_exposed_form_buttons', ['query' => [$identifier => 'article']]);
@ -131,9 +131,9 @@ class ExposedFormTest extends ViewTestBase {
'label' => 'Content: Type',
'operator_id' => 'type_op',
'reduce' => FALSE,
'description' => 'Exposed overridden description'
'description' => 'Exposed overridden description',
],
]
],
]);
$this->executeView($view);
@ -191,48 +191,6 @@ class ExposedFormTest extends ViewTestBase {
$this->helperButtonHasLabel('edit-reset', $expected_label);
}
/**
* Tests overriding the default render option with checkboxes.
*/
public function testExposedFormRenderCheckboxes() {
// Make sure we have at least two options for node type.
$this->drupalCreateContentType(['type' => 'page']);
$this->drupalCreateNode(['type' => 'page']);
// Use a test theme to convert multi-select elements into checkboxes.
\Drupal::service('theme_handler')->install(['views_test_checkboxes_theme']);
$this->config('system.theme')
->set('default', 'views_test_checkboxes_theme')
->save();
// Set the "type" filter to multi-select.
$view = Views::getView('test_exposed_form_buttons');
$filter = $view->getHandler('page_1', 'filter', 'type');
$filter['expose']['multiple'] = TRUE;
$view->setHandler('page_1', 'filter', 'type', $filter);
// Only display 5 items per page so we can test that paging works.
$display = &$view->storage->getDisplay('default');
$display['display_options']['pager']['options']['items_per_page'] = 5;
$view->save();
$this->drupalGet('test_exposed_form_buttons');
$actual = $this->xpath('//form//input[@type="checkbox" and @name="type[article]"]');
$this->assertEqual(count($actual), 1, 'Article option renders as a checkbox.');
$actual = $this->xpath('//form//input[@type="checkbox" and @name="type[page]"]');
$this->assertEqual(count($actual), 1, 'Page option renders as a checkbox');
// Ensure that all results are displayed.
$rows = $this->xpath("//div[contains(@class, 'views-row')]");
$this->assertEqual(count($rows), 5, '5 rows are displayed by default on the first page when no options are checked.');
$this->clickLink('Page 2');
$rows = $this->xpath("//div[contains(@class, 'views-row')]");
$this->assertEqual(count($rows), 1, '1 row is displayed by default on the second page when no options are checked.');
$this->assertNoText('An illegal choice has been detected. Please contact the site administrator.');
}
/**
* Tests the exposed block functionality.
*/
@ -320,8 +278,7 @@ class ExposedFormTest extends ViewTestBase {
*/
public function testExposedSortAndItemsPerPage() {
for ($i = 0; $i < 50; $i++) {
$entity = EntityTest::create([
]);
$entity = EntityTest::create([]);
$entity->save();
}
$contexts = [
@ -329,7 +286,7 @@ class ExposedFormTest extends ViewTestBase {
'entity_test_view_grants',
'theme',
'url.query_args',
'languages:language_content'
'languages:language_content',
];
$this->drupalGet('test_exposed_form_sort_items_per_page');

View file

@ -2,7 +2,7 @@
namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Views;
use Drupal\language\Entity\ConfigurableLanguage;
@ -93,7 +93,7 @@ class PagerTest extends ViewTestBase {
$this->assertText('20 items');
// add new display and test the settings again, by override it.
$edit = [ ];
$edit = [];
// Add a display and override the pager settings.
$this->drupalPostForm('admin/structure/views/view/test_store_pager_settings/edit', $edit, t('Add Page'));
$edit = [
@ -418,7 +418,7 @@ class PagerTest extends ViewTestBase {
// Create source string.
$source = $this->localeStorage->createString(
[
'source' => $label
'source' => $label,
]
);
$source->save();

View file

@ -0,0 +1,79 @@
<?php
namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\Tests\views\Functional\ViewTestBase;
/**
* Tests the OPML feed style plugin.
*
* @group views
* @see \Drupal\views\Plugin\views\style\Opml
*/
class StyleOpmlTest extends ViewTestBase {
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = ['test_style_opml'];
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['aggregator'];
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views);
$this->enableViewsTestModule();
$admin_user = $this->drupalCreateUser(['administer news feeds']);
$this->drupalLogin($admin_user);
}
/**
* Tests the rendered output.
*/
public function testOpmlOutput() {
// Create a test feed.
$values = [
'title' => $this->randomMachineName(10),
'url' => 'http://example.com/rss.xml',
'refresh' => '900',
];
$feed = $this->container->get('entity.manager')
->getStorage('aggregator_feed')
->create($values);
$feed->save();
$this->drupalGet('test-feed-opml-style');
$outline = $this->getSession()->getDriver()->find('//outline[1]')[0];
$this->assertEquals('rss', $outline->getAttribute('type'));
$this->assertEquals($feed->label(), $outline->getAttribute('text'));
$this->assertEquals($feed->getUrl(), $outline->getAttribute('xmlUrl'));
$view = $this->container->get('entity.manager')
->getStorage('view')
->load('test_style_opml');
$display = &$view->getDisplay('feed_1');
$display['display_options']['row']['options']['type_field'] = 'link';
$display['display_options']['row']['options']['url_field'] = 'url';
$view->save();
$this->drupalGet('test-feed-opml-style');
$outline = $this->getSession()->getDriver()->find('//outline[1]')[0];
$this->assertEquals('link', $outline->getAttribute('type'));
$this->assertEquals($feed->label(), $outline->getAttribute('text'));
$this->assertEquals($feed->getUrl(), $outline->getAttribute('url'));
// xmlUrl should not be present when type is link.
$this->assertNull($outline->getAttribute('xmlUrl'));
}
}

View file

@ -54,6 +54,9 @@ class StyleSummaryTest extends ViewTestBase {
public function testSummaryView() {
$this->drupalGet('test-summary');
// Ensure styles are properly added for summary views.
$this->assertRaw('stable/css/views/views.module.css');
$summary_list = $this->cssSelect('ul.views-summary li');
$this->assertEqual(4, count($summary_list));

View file

@ -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));
}
}

View file

@ -173,7 +173,6 @@ class StyleTest extends ViewTestBase {
$expected['Job: Drummer']['rows']['Age: 28']['rows'][2]->views_test_data_age = '28';
$expected['Job: Drummer']['rows']['Age: 28']['rows'][2]->views_test_data_id = '3';
// Alter the results to support the stripped case.
if ($stripped) {
@ -194,7 +193,6 @@ class StyleTest extends ViewTestBase {
$view->style_plugin->options['grouping'][1] = ['field' => 'age', 'rendered' => TRUE, 'rendered_strip' => TRUE];
}
// The newer api passes the value of the grouping as well.
$sets_new_rendered = $view->style_plugin->renderGrouping($view->result, $view->style_plugin->options['grouping'], TRUE);

View file

@ -41,7 +41,7 @@ class ViewsBulkTest extends ViewTestBase {
$node_1 = $this->drupalCreateNode([
'type' => 'page',
'title' => 'The first node',
'changed' => \Drupal::time()->getRequestTime() - 180
'changed' => \Drupal::time()->getRequestTime() - 180,
]);
// Login as administrator and go to admin/content.
@ -53,7 +53,7 @@ class ViewsBulkTest extends ViewTestBase {
$node_2 = $this->drupalCreateNode([
'type' => 'page',
'title' => 'The second node',
'changed' => \Drupal::time()->getRequestTime() - 120
'changed' => \Drupal::time()->getRequestTime() - 120,
]);
// Now click 'Apply to selected items' and assert the first node is selected
@ -70,9 +70,9 @@ class ViewsBulkTest extends ViewTestBase {
// Create third node now that the admin overview has been rendered.
$node_3 = $this->drupalCreateNode([
'type' => 'page',
'title' => 'The third node']
);
'type' => 'page',
'title' => 'The third node',
]);
// Now click 'Apply to selected items' and assert the second node is
// selected on the confirm form.

View file

@ -27,7 +27,7 @@ class ViewsFormTest extends ViewTestBase {
$xpath = $this->cssSelect('.views-form form');
$this->assertIdentical(count($xpath), 1, 'There is one views form on the page.');
// Ensure we don't have nested form elements.
$result = (bool) preg_match('#<form[^>]*?>(?!/form).*<form#s', $this->getRawContent());
$result = (bool) preg_match('#<form[^>]*?>(?!/form).*<form#s', $this->getSession()->getPage()->getContent());
$this->assertFalse($result, 'The views form element is not nested.');
}

View file

@ -0,0 +1,24 @@
<?php
namespace Drupal\Tests\views\Functional\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
/**
* @group rest
*/
class ViewJsonAnonTest extends ViewResourceTestBase {
use AnonResourceTestTrait;
/**
* {@inheritdoc}
*/
protected static $format = 'json';
/**
* {@inheritdoc}
*/
protected static $mimeType = 'application/json';
}

View file

@ -0,0 +1,34 @@
<?php
namespace Drupal\Tests\views\Functional\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
/**
* @group rest
*/
class ViewJsonBasicAuthTest extends ViewResourceTestBase {
use BasicAuthResourceTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = ['basic_auth'];
/**
* {@inheritdoc}
*/
protected static $format = 'json';
/**
* {@inheritdoc}
*/
protected static $mimeType = 'application/json';
/**
* {@inheritdoc}
*/
protected static $auth = 'basic_auth';
}

View file

@ -0,0 +1,29 @@
<?php
namespace Drupal\Tests\views\Functional\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
/**
* @group rest
*/
class ViewJsonCookieTest extends ViewResourceTestBase {
use CookieResourceTestTrait;
/**
* {@inheritdoc}
*/
protected static $format = 'json';
/**
* {@inheritdoc}
*/
protected static $mimeType = 'application/json';
/**
* {@inheritdoc}
*/
protected static $auth = 'cookie';
}

View file

@ -0,0 +1,99 @@
<?php
namespace Drupal\Tests\views\Functional\Rest;
use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
use Drupal\views\Entity\View;
abstract class ViewResourceTestBase extends EntityResourceTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['views'];
/**
* {@inheritdoc}
*/
protected static $entityTypeId = 'view';
/**
* @var \Drupal\views\ViewEntityInterface
*/
protected $entity;
/**
* {@inheritdoc}
*/
protected function setUpAuthorization($method) {
$this->grantPermissionsToTestedRole(['administer views']);
}
/**
* {@inheritdoc}
*/
protected function createEntity() {
$view = View::create([
'id' => 'test_rest',
'label' => 'Test REST',
]);
$view->save();
return $view;
}
/**
* {@inheritdoc}
*/
protected function getExpectedNormalizedEntity() {
return [
'base_field' => 'nid',
'base_table' => 'node',
'core' => '8.x',
'dependencies' => [],
'description' => '',
'display' => [
'default' => [
'display_plugin' => 'default',
'id' => 'default',
'display_title' => 'Master',
'position' => 0,
'display_options' => [
'display_extenders' => [],
],
'cache_metadata' => [
'max-age' => -1,
'contexts' => [
'languages:language_interface',
'url.query_args',
],
'tags' => [],
],
],
],
'id' => 'test_rest',
'label' => 'Test REST',
'langcode' => 'en',
'module' => 'views',
'status' => TRUE,
'tag' => '',
'uuid' => $this->entity->uuid(),
];
}
/**
* {@inheritdoc}
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
}
/**
* {@inheritdoc}
*/
protected function getExpectedCacheContexts() {
return [
'user.permissions',
];
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace Drupal\Tests\views\Functional\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
/**
* @group rest
*/
class ViewXmlAnonTest extends ViewResourceTestBase {
use AnonResourceTestTrait;
use XmlEntityNormalizationQuirksTrait;
/**
* {@inheritdoc}
*/
protected static $format = 'xml';
/**
* {@inheritdoc}
*/
protected static $mimeType = 'text/xml; charset=UTF-8';
}

View file

@ -0,0 +1,36 @@
<?php
namespace Drupal\Tests\views\Functional\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
/**
* @group rest
*/
class ViewXmlBasicAuthTest extends ViewResourceTestBase {
use BasicAuthResourceTestTrait;
use XmlEntityNormalizationQuirksTrait;
/**
* {@inheritdoc}
*/
public static $modules = ['basic_auth'];
/**
* {@inheritdoc}
*/
protected static $format = 'xml';
/**
* {@inheritdoc}
*/
protected static $mimeType = 'text/xml; charset=UTF-8';
/**
* {@inheritdoc}
*/
protected static $auth = 'basic_auth';
}

View file

@ -0,0 +1,31 @@
<?php
namespace Drupal\Tests\views\Functional\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
/**
* @group rest
*/
class ViewXmlCookieTest extends ViewResourceTestBase {
use CookieResourceTestTrait;
use XmlEntityNormalizationQuirksTrait;
/**
* {@inheritdoc}
*/
protected static $format = 'xml';
/**
* {@inheritdoc}
*/
protected static $mimeType = 'text/xml; charset=UTF-8';
/**
* {@inheritdoc}
*/
protected static $auth = 'cookie';
}

View file

@ -2,7 +2,7 @@
namespace Drupal\Tests\views\Functional;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Tests\Traits\Core\CronRunTrait;
/**
@ -145,7 +145,7 @@ class SearchIntegrationTest extends ViewTestBase {
*/
protected function assertOneLink($label) {
$links = $this->xpath('//a[normalize-space(text())=:label]', [':label' => $label]);
$message = SafeMarkup::format('Link with label %label found once.', ['%label' => $label]);
$message = new FormattableMarkup('Link with label %label found once.', ['%label' => $label]);
return $this->assert(isset($links[0]) && !isset($links[1]), $message);
}

View file

@ -2,7 +2,7 @@
namespace Drupal\Tests\views\Functional;
use Drupal\taxonomy\Tests\TaxonomyTestTrait;
use Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait;
/**
* Tests glossary functionality of taxonomy views.

View file

@ -0,0 +1,52 @@
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Entity\View;
/**
* Tests the argument placeholder update path.
*
* @see views_update_8002()
*
* @group views
* @group legacy
*/
class ArgumentPlaceholderUpdatePathTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/argument-placeholder.php',
];
}
/**
* Ensures that %1 and !1 are converted to twig tokens in existing views.
*/
public function testArgumentPlaceholderUpdate() {
$this->runUpdates();
$view = View::load('test_token_view');
$data = $view->toArray();
$this->assertEqual('{{ arguments.nid }}-test-class-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['style']['options']['col_class_custom']);
$this->assertEqual('{{ arguments.nid }}-test-class-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['style']['options']['row_class_custom']);
$this->assertEqual('{{ arguments.nid }}-description-{{ raw_arguments.nid }}', $data['display']['feed_1']['display_options']['style']['options']['description']);
$this->assertEqual('{{ arguments.nid }}-custom-text-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['fields']['title']['alter']['text']);
$this->assertEqual('test_token_view {{ arguments.nid }} {{ raw_arguments.nid }}', $data['display']['default']['display_options']['title']);
$this->assertEqual('{{ arguments.nid }}-custom-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['header']['area_text_custom']['content']);
$this->assertEqual('{{ arguments.nid }}-text-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['footer']['area']['content']['value']);
$this->assertEqual("Displaying @start - @end of @total\n\n{{ arguments.nid }}-result-{{ raw_arguments.nid }}", $data['display']['default']['display_options']['empty']['result']['content']);
$this->assertEqual('{{ arguments.nid }}-title-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['empty']['title']['title']);
$this->assertEqual('{{ arguments.nid }}-entity-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['empty']['entity_node']['target']);
$this->assertEqual('{{ arguments.nid }} title {{ raw_arguments.nid }}', $data['display']['default']['display_options']['arguments']['nid']['title']);
$this->assertEqual('{{ arguments.nid }} exception-title {{ raw_arguments.nid }}', $data['display']['default']['display_options']['arguments']['nid']['exception']['title']);
$this->assertEqual('{{ arguments.nid }}-more-text-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['use_more_text']);
$this->assertEqual('{{ arguments.nid }}-custom-url-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['link_url']);
}
}

View file

@ -0,0 +1,41 @@
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Entity\View;
/**
* Tests the upgrade path for boolean field values.
*
* @see views_post_update_boolean_filter_values()
*
* @group Update
* @group legacy
*/
class BooleanFilterValuesUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/boolean-filter-values.php',
];
}
/**
* Tests that boolean filter values are updated properly.
*/
public function testViewsPostUpdateBooleanFilterValues() {
$this->runUpdates();
// Load and initialize our test view.
$view = View::load('test_boolean_filter_values');
$data = $view->toArray();
// Check that the field is using the expected string value.
$this->assertIdentical('1', $data['display']['default']['display_options']['filters']['status']['value']);
}
}

View file

@ -0,0 +1,41 @@
<?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
* @group legacy
*/
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));
}
}

View file

@ -0,0 +1,42 @@
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Views;
/**
* Tests that views cacheability metadata post update hook runs properly.
*
* @see views_post_update_update_cacheability_metadata().
*
* @group Update
* @group legacy
*/
class CacheabilityMetadataUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz'];
}
/**
* Tests that views cacheability metadata updated properly.
*/
public function testUpdateHookN() {
$this->runUpdates();
foreach (Views::getAllViews() as $view) {
$displays = $view->get('display');
foreach (array_keys($displays) as $display_id) {
$display = $view->getDisplay($display_id);
$this->assertFalse(isset($display['cache_metadata']['cacheable']));
$this->assertTrue(isset($display['cache_metadata']['contexts']));
$this->assertTrue(isset($display['cache_metadata']['max-age']));
$this->assertTrue(isset($display['cache_metadata']['tags']));
}
}
}
}

View file

@ -0,0 +1,41 @@
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Entity\View;
/**
* Tests that the additional settings are added to the entity link field.
*
* @see views_post_update_entity_link_url()
*
* @group legacy
*/
class EntityLinkOutputUrlUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/entity-link-output-url.php',
];
}
/**
* Tests that the additional settings are added to the config.
*/
public function testViewsPostUpdateEntityLinkUrl() {
$this->runUpdates();
// Load and initialize our test view.
$view = View::load('node_link_update_test');
$data = $view->toArray();
// Check that the field contains the new values.
$this->assertIdentical(FALSE, $data['display']['default']['display_options']['fields']['view_node']['output_url_as_text']);
$this->assertIdentical(FALSE, $data['display']['default']['display_options']['fields']['view_node']['absolute']);
}
}

View file

@ -0,0 +1,21 @@
<?php
namespace Drupal\Tests\views\Functional\Update;
/**
* Runs EntityViewsDataUpdateTest with a dump filled with content.
*
* @group Update
* @group legacy
*/
class EntityViewsDataUpdateFilledTest extends EntityViewsDataUpdateTest {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
parent::setDatabaseDumpFiles();
$this->databaseDumpFiles[0] = __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.filled.standard.php.gz';
}
}

View file

@ -0,0 +1,82 @@
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Views;
/**
* Tests the upgrade path for views field plugins.
*
* @see https://www.drupal.org/node/2455125
*
* @group Update
* @group legacy
*/
class EntityViewsDataUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.views-entity-views-data-2455125.php',
];
}
/**
* Tests that field plugins are updated properly.
*/
public function testUpdateHookN() {
$this->runUpdates();
// Load and initialize our test view.
$view = Views::getView('update_test');
$view->initHandlers();
// Extract the fields from the test view that were updated.
/** @var \Drupal\views\Plugin\views\field\EntityField $field */
$created = $view->field['created'];
/** @var \Drupal\views\Plugin\views\field\EntityField $field */
$created_1 = $view->field['created_1'];
/** @var \Drupal\views\Plugin\views\field\EntityField $field */
$created_2 = $view->field['created_2'];
// Make sure the plugins were converted from date to field.
$this->assertEqual($created->getPluginId(), 'field', 'created has correct plugin_id');
$this->assertEqual($created_1->getPluginId(), 'field', 'created has correct plugin_id');
$this->assertEqual($created_2->getPluginId(), 'field', 'created has correct plugin_id');
// Check options on 'created'.
$options = $created->options;
$this->assertEqual($options['type'], 'timestamp');
$this->assertFalse(array_key_exists('date_format', $options));
$this->assertFalse(array_key_exists('custom_date_format', $options));
$this->assertFalse(array_key_exists('timezone', $options));
$this->assertEqual($options['settings']['date_format'], 'long');
$this->assertEqual($options['settings']['custom_date_format'], '');
$this->assertEqual($options['settings']['timezone'], 'Africa/Abidjan');
// Check options on 'created'.
$options = $created_1->options;
$this->assertEqual($options['type'], 'timestamp_ago');
$this->assertFalse(array_key_exists('date_format', $options));
$this->assertFalse(array_key_exists('custom_date_format', $options));
$this->assertFalse(array_key_exists('timezone', $options));
$this->assertEqual($options['settings']['future_format'], '@interval');
$this->assertEqual($options['settings']['past_format'], '@interval');
$this->assertEqual($options['settings']['granularity'], 2);
// Check options on 'created'.
$options = $created_2->options;
$this->assertEqual($options['type'], 'timestamp_ago');
$this->assertFalse(array_key_exists('date_format', $options));
$this->assertFalse(array_key_exists('custom_date_format', $options));
$this->assertFalse(array_key_exists('timezone', $options));
$this->assertEqual($options['settings']['future_format'], '@interval hence');
$this->assertEqual($options['settings']['past_format'], '@interval ago');
$this->assertEqual($options['settings']['granularity'], 2);
}
}

View file

@ -0,0 +1,54 @@
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Views;
/**
* Tests the upgrade path for views multi-value base field data.
*
* @see views_update_8500()
*
* @group legacy
*/
class EntityViewsMultiValueBaseFieldDataUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.views-entity-views-data-2846614.php',
];
}
/**
* Tests multi-value base field views data is updated correctly.
*/
public function testUpdateMultiValueBaseFields() {
$this->runUpdates();
$view = Views::getView('test_user_multi_value');
$display = $view->storage->get('display');
// Check each handler type present in the configuration to make sure the
// field got updated correctly.
foreach (['fields', 'filters', 'arguments'] as $type) {
$handler_config = $display['default']['display_options'][$type]['roles'];
// The ID should remain unchanged. Otherwise the update handler could
// overwrite a separate handler config.
$this->assertEqual('roles', $handler_config['id']);
// The field should be updated from 'roles' to the correct column name.
$this->assertEqual('roles_target_id', $handler_config['field']);
// Check the table is still correct.
$this->assertEqual('user__roles', $handler_config['table']);
// The plugin ID should be updated as well.
$this->assertEqual($type === 'arguments' ? 'user__roles_rid' : 'user_roles', $handler_config['plugin_id']);
}
}
}

View file

@ -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 views field handlers.
*
* @see views_post_update_cleanup_duplicate_views_data()
*
* @group Update
* @group legacy
*/
class FieldHandlersUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/duplicate-field-handler.php',
];
}
/**
* Tests that field handlers are updated properly.
*/
public function testViewsUpdate8004() {
$this->runUpdates();
// Load and initialize our test view.
$view = View::load('test_duplicate_field_handlers');
$data = $view->toArray();
// Check that the field is using the expected base table.
$this->assertEqual('node_field_data', $data['display']['default']['display_options']['fields']['nid']['table']);
$this->assertEqual('node_field_data', $data['display']['default']['display_options']['filters']['type']['table']);
$this->assertEqual('node_field_data', $data['display']['default']['display_options']['sorts']['vid']['table']);
$this->assertEqual('node_field_data', $data['display']['default']['display_options']['arguments']['nid']['table']);
}
}

View file

@ -0,0 +1,52 @@
<?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
* @group legacy
*/
class ImageStyleDependencyUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8-rc1.bare.standard.php.gz',
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal8.views-image-style-dependency-2649914.php',
];
}
/**
* Tests the updating of views dependencies to image styles.
*/
public function testUpdateImageStyleDependencies() {
$config_dependencies = View::load('foo')->getDependencies()['config'];
// Checks that 'thumbnail' image style is not a dependency of view 'foo'.
$this->assertFalse(in_array('image.style.thumbnail', $config_dependencies));
// We test the case the the field formatter image style doesn't exist.
// Checks that 'nonexistent' image style is not a dependency of view 'foo'.
$this->assertFalse(in_array('image.style.nonexistent', $config_dependencies));
// Run updates.
$this->runUpdates();
$config_dependencies = View::load('foo')->getDependencies()['config'];
// Checks that 'thumbnail' image style is a dependency of view 'foo'.
$this->assertTrue(in_array('image.style.thumbnail', $config_dependencies));
// The 'nonexistent' style doesn't exist, thus is not a dependency. Checks
// that 'nonexistent' image style is a not dependency of view 'foo'.
$this->assertFalse(in_array('image.style.nonexistent', $config_dependencies));
}
}

View file

@ -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 placeholder text.
*
* @see views_post_update_filter_placeholder_text()
*
* @group Update
* @group legacy
*/
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']);
}
}

View file

@ -0,0 +1,45 @@
<?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
* @group legacy
*/
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']);
}
}

View file

@ -0,0 +1,41 @@
<?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
* @group legacy
*/
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());
}
}

Some files were not shown because too many files have changed in this diff Show more