Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023
This commit is contained in:
parent
2720a9ec4b
commit
f3791f1da3
1898 changed files with 54300 additions and 11481 deletions
|
@ -29,7 +29,12 @@ display:
|
|||
table: views_test_data
|
||||
field: created
|
||||
label: created
|
||||
plugin_id: date
|
||||
plugin_id: field
|
||||
type: timestamp
|
||||
settings:
|
||||
date_format: medium
|
||||
custom_date_format: ''
|
||||
timezone: ''
|
||||
access:
|
||||
type: none
|
||||
cache:
|
||||
|
|
|
@ -62,7 +62,12 @@ display:
|
|||
field: created
|
||||
id: created
|
||||
table: node_field_data
|
||||
plugin_id: date
|
||||
plugin_id: field
|
||||
type: timestamp
|
||||
settings:
|
||||
date_format: medium
|
||||
custom_date_format: ''
|
||||
timezone: ''
|
||||
entity_type: node
|
||||
entity_field: created
|
||||
nid:
|
||||
|
|
|
@ -32,6 +32,15 @@ display:
|
|||
entity_field: field_test
|
||||
style:
|
||||
type: html_list
|
||||
sorts:
|
||||
id:
|
||||
id: vid
|
||||
table: entity_test
|
||||
field: id
|
||||
order: ASC
|
||||
plugin_id: field
|
||||
entity_type: entity_test
|
||||
entity_field: id
|
||||
display_plugin: default
|
||||
display_title: Master
|
||||
id: default
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies: { }
|
||||
id: test_page_display_path
|
||||
label: ''
|
||||
module: views
|
||||
description: ''
|
||||
tag: ''
|
||||
base_table: views_test_data
|
||||
base_field: nid
|
||||
core: '8'
|
||||
display:
|
||||
default:
|
||||
display_options:
|
||||
title: 'Test page display path'
|
||||
defaults:
|
||||
fields: false
|
||||
pager: false
|
||||
sorts: false
|
||||
fields:
|
||||
age:
|
||||
field: age
|
||||
id: age
|
||||
relationship: none
|
||||
table: views_test_data
|
||||
plugin_id: numeric
|
||||
display_plugin: default
|
||||
display_title: Master
|
||||
id: default
|
||||
position: 0
|
||||
page_1:
|
||||
display_options:
|
||||
path: test_page_display_path
|
||||
display_plugin: page
|
||||
display_title: Page
|
||||
id: page_1
|
|
@ -107,21 +107,15 @@ display:
|
|||
entity_type: node
|
||||
entity_field: status
|
||||
sorts:
|
||||
created:
|
||||
id: created
|
||||
table: node_field_data
|
||||
field: created
|
||||
order: DESC
|
||||
score:
|
||||
id: score
|
||||
table: node_search_index
|
||||
field: score
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
exposed: false
|
||||
expose:
|
||||
label: ''
|
||||
granularity: second
|
||||
plugin_id: date
|
||||
entity_type: node
|
||||
entity_field: created
|
||||
order: DESC
|
||||
plugin_id: search_score
|
||||
title: ''
|
||||
header: { }
|
||||
footer: { }
|
||||
|
|
|
@ -251,10 +251,12 @@ display:
|
|||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
date_format: html_date
|
||||
custom_date_format: ''
|
||||
timezone: ''
|
||||
plugin_id: date
|
||||
type: timestamp
|
||||
settings:
|
||||
date_format: html_date
|
||||
custom_date_format: ''
|
||||
timezone: ''
|
||||
plugin_id: field
|
||||
entity_type: aggregator_feed
|
||||
entity_field: modified
|
||||
filters: { }
|
||||
|
|
|
@ -59,3 +59,40 @@ display:
|
|||
display_title: Embedded
|
||||
id: embed_1
|
||||
position: 1
|
||||
embed_2:
|
||||
display_options:
|
||||
defaults:
|
||||
filters: false
|
||||
exposed_form: false
|
||||
exposed_form:
|
||||
type: basic
|
||||
options:
|
||||
submit_button: Filter
|
||||
reset_button: true
|
||||
reset_button_label: Reset
|
||||
exposed_sorts_label: 'Sort by'
|
||||
expose_sort_order: true
|
||||
sort_asc_label: Asc
|
||||
sort_desc_label: Desc
|
||||
filters:
|
||||
id:
|
||||
field: id
|
||||
id: id
|
||||
relationship: none
|
||||
table: views_test_data
|
||||
plugin_id: numeric
|
||||
exposed: true
|
||||
expose:
|
||||
operator_id: ''
|
||||
label: Id
|
||||
description: ''
|
||||
identifier: id
|
||||
required: false
|
||||
remember: false
|
||||
multiple: false
|
||||
remember_roles:
|
||||
authenticated: authenticated
|
||||
display_plugin: embed
|
||||
display_title: Embedded
|
||||
id: embed_2
|
||||
position: 2
|
||||
|
|
|
@ -28,7 +28,7 @@ views.style.mapping_test:
|
|||
label: 'Toggle title field'
|
||||
|
||||
views_test_data.tests:
|
||||
type: mapping
|
||||
type: config_object
|
||||
label: 'Views test data tests'
|
||||
mapping:
|
||||
handler_access_callback:
|
||||
|
|
|
@ -46,7 +46,7 @@ class FieldTest extends FieldPluginBase {
|
|||
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::addSelfTokens().
|
||||
*/
|
||||
protected function addSelfTokens(&$tokens, $item) {
|
||||
$tokens['[test-token]'] = $this->getTestValue();
|
||||
$tokens['[test__token]'] = $this->getTestValue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\views_test_data\Plugin\views\filter\FilterExceptionTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\views_test_data\Plugin\views\filter;
|
||||
|
||||
use Drupal\views\Plugin\views\filter\FilterPluginBase;
|
||||
|
||||
/**
|
||||
* Breaks the query with adding an invalid where expression.
|
||||
*
|
||||
* @ViewsFilter("test_exception_filter")
|
||||
*/
|
||||
class FilterExceptionTest extends FilterPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$this->query->addWhereExpression(NULL, "syntax error");
|
||||
}
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
use Drupal\field\FieldStorageConfigInterface;
|
||||
use Drupal\views\Plugin\views\cache\CachePluginBase;
|
||||
use Drupal\views\ViewExecutable;
|
||||
|
||||
/**
|
||||
|
@ -18,8 +19,13 @@ function views_test_data_views_query_substitutions(ViewExecutable $view) {
|
|||
/**
|
||||
* Implements hook_views_form_substitutions().
|
||||
*/
|
||||
function views_test_data_views_form_substitutions(ViewExecutable $view) {
|
||||
function views_test_data_views_form_substitutions() {
|
||||
\Drupal::state()->set('views_hook_test_views_form_substitutions', TRUE);
|
||||
$render = ['#markup' => '<em>unescaped</em>'];
|
||||
return array(
|
||||
'<!--will-be-escaped-->' => '<em>escaped</em>',
|
||||
'<!--will-be-not-escaped-->' => \Drupal::service('renderer')->renderPlain($render),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +72,7 @@ function views_test_data_placeholders() {
|
|||
/**
|
||||
* Implements hook_views_post_render().
|
||||
*/
|
||||
function views_test_data_views_post_render(ViewExecutable $view) {
|
||||
function views_test_data_views_post_render(ViewExecutable $view, &$output, CachePluginBase $cache) {
|
||||
\Drupal::state()->set('views_hook_test_views_post_render', TRUE);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,12 +90,13 @@ class ViewAjaxControllerTest extends UnitTestCase {
|
|||
|
||||
$this->viewAjaxController = new ViewAjaxController($this->viewStorage, $this->executableFactory, $this->renderer, $this->currentPath, $this->redirectDestination);
|
||||
|
||||
$element_info_manager = $this->getMock('\Drupal\Core\Render\ElementInfoManagerInterface');
|
||||
$request_stack = new RequestStack();
|
||||
$request_stack->push(new Request());
|
||||
$args = [
|
||||
$this->getMock('\Drupal\Core\Controller\ControllerResolverInterface'),
|
||||
$this->getMock('\Drupal\Core\Theme\ThemeManagerInterface'),
|
||||
$this->getMock('\Drupal\Core\Render\ElementInfoManagerInterface'),
|
||||
$element_info_manager,
|
||||
$this->getMock('\Drupal\Core\Render\RenderCacheInterface'),
|
||||
$request_stack,
|
||||
[
|
||||
|
|
|
@ -930,13 +930,10 @@ class TestEntityType extends EntityType {
|
|||
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
|
||||
if (!function_exists('t')) {
|
||||
function t($string, array $args = []) {
|
||||
return SafeMarkup::format($string, $args);
|
||||
return strtr($string, $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ class ViewsBlockTest extends UnitTestCase {
|
|||
*/
|
||||
public function testBuild() {
|
||||
$output = $this->randomMachineName(100);
|
||||
$build = array('#markup' => $output, '#view_id' => 'test_view', '#view_display_plugin_class' => '\Drupal\views\Plugin\views\display\Block', '#view_display_show_admin_links' => FALSE, '#view_display_plugin_id' => 'block');
|
||||
$build = array('view_build' => $output, '#view_id' => 'test_view', '#view_display_plugin_class' => '\Drupal\views\Plugin\views\display\Block', '#view_display_show_admin_links' => FALSE, '#view_display_plugin_id' => 'block', '#pre_rendered' => TRUE);
|
||||
$this->executable->expects($this->once())
|
||||
->method('buildRenderable')
|
||||
->with('block_1', [])
|
||||
|
@ -157,6 +157,28 @@ class ViewsBlockTest extends UnitTestCase {
|
|||
$this->assertEquals($build, $plugin->build());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the build method.
|
||||
*
|
||||
* @covers ::build
|
||||
*/
|
||||
public function testBuildEmpty() {
|
||||
$build = ['view_build' => [], '#view_id' => 'test_view', '#view_display_plugin_class' => '\Drupal\views\Plugin\views\display\Block', '#view_display_show_admin_links' => FALSE, '#view_display_plugin_id' => 'block', '#pre_rendered' => TRUE, '#cache' => ['contexts' => ['user']]];
|
||||
$this->executable->expects($this->once())
|
||||
->method('buildRenderable')
|
||||
->with('block_1', [])
|
||||
->willReturn($build);
|
||||
|
||||
$block_id = 'views_block:test_view-block_1';
|
||||
$config = [];
|
||||
$definition = [];
|
||||
|
||||
$definition['provider'] = 'views';
|
||||
$plugin = new ViewsBlock($config, $block_id, $definition, $this->executableFactory, $this->storage, $this->account);
|
||||
|
||||
$this->assertEquals(array_intersect_key($build, ['#cache' => TRUE]), $plugin->build());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the build method with a failed execution.
|
||||
*
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\Tests\views\Unit\Plugin\field;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
use Drupal\views\Entity\View;
|
||||
use Drupal\views\Plugin\views\field\Counter;
|
||||
|
@ -125,15 +124,9 @@ class CounterTest extends UnitTestCase {
|
|||
$expected = $i + 1;
|
||||
|
||||
$counter = $counter_handler->getValue($this->testData[$i]);
|
||||
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
|
||||
'@expected' => $expected,
|
||||
'@counter' => $counter
|
||||
)));
|
||||
$this->assertEquals($expected, $counter, 'The expected number matches with the counter number');
|
||||
$counter = $this->renderCounter($counter_handler, $this->testData[$i]);
|
||||
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
|
||||
'@expected' => $expected,
|
||||
'@counter' => $counter
|
||||
)));
|
||||
$this->assertEquals($expected, $counter, 'The expected number matches with the rendered number');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,15 +150,9 @@ class CounterTest extends UnitTestCase {
|
|||
$expected = $rand_start + $i;
|
||||
|
||||
$counter = $counter_handler->getValue($this->testData[$i]);
|
||||
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
|
||||
'@expected' => $expected,
|
||||
'@counter' => $counter
|
||||
)));
|
||||
$this->assertEquals($expected, $counter, 'The expected number matches with the counter number');
|
||||
$counter = $this->renderCounter($counter_handler, $this->testData[$i]);
|
||||
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
|
||||
'@expected' => $expected,
|
||||
'@counter' => $counter
|
||||
)));
|
||||
$this->assertEquals($expected, $counter, 'The expected number matches with the rendered number');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -192,15 +179,9 @@ class CounterTest extends UnitTestCase {
|
|||
$expected = $offset + $rand_start + $i;
|
||||
|
||||
$counter = $counter_handler->getValue($this->testData[$i]);
|
||||
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
|
||||
'@expected' => $expected,
|
||||
'@counter' => $counter
|
||||
)));
|
||||
$this->assertEquals($expected, $counter, 'The expected number matches with the counter number');
|
||||
$counter = $this->renderCounter($counter_handler, $this->testData[$i]);
|
||||
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
|
||||
'@expected' => $expected,
|
||||
'@counter' => $counter
|
||||
)));
|
||||
$this->assertEquals($expected, $counter, 'The expected number matches with the rendered number');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -231,15 +212,9 @@ class CounterTest extends UnitTestCase {
|
|||
$expected = $items_per_page + $offset + $rand_start + $i;
|
||||
|
||||
$counter = $counter_handler->getValue($this->testData[$i]);
|
||||
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
|
||||
'@expected' => $expected,
|
||||
'@counter' => $counter
|
||||
)));
|
||||
$this->assertEquals($expected, $counter, 'The expected number matches with the counter number');
|
||||
$counter = $this->renderCounter($counter_handler, $this->testData[$i]);
|
||||
$this->assertEquals($expected, $counter, SafeMarkup::format('The expected number (@expected) patches with the rendered number (@counter) failed', array(
|
||||
'@expected' => $expected,
|
||||
'@counter' => $counter
|
||||
)));
|
||||
$this->assertEquals($expected, $counter, 'The expected number matches with the rendered number');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\Tests\views\Unit;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
use Drupal\views\ViewsDataHelper;
|
||||
use Drupal\views\Tests\ViewTestData;
|
||||
|
@ -106,7 +105,7 @@ class ViewsDataHelperTest extends UnitTestCase {
|
|||
array_walk($expected_keys, function(&$item) {
|
||||
$item = "views_test_data.$item";
|
||||
});
|
||||
$this->assertEquals($expected_keys, array_keys($fields), SafeMarkup::format('Handlers of type @handler_type are not listed as expected.', array('@handler_type' => $handler_type)));
|
||||
$this->assertEquals($expected_keys, array_keys($fields), "Handlers of type $handler_type are not listed as expected");
|
||||
}
|
||||
|
||||
// Check for subtype filtering, so header and footer.
|
||||
|
@ -117,7 +116,7 @@ class ViewsDataHelperTest extends UnitTestCase {
|
|||
array_walk($expected_keys, function(&$item) {
|
||||
$item = "views_test_data.$item";
|
||||
});
|
||||
$this->assertEquals($expected_keys, array_keys($fields), SafeMarkup::format('Sub_type @sub_type is not filtered as expected.', array('@sub_type' => $sub_type)));
|
||||
$this->assertEquals($expected_keys, array_keys($fields), "Sub_type $sub_type is not filtered as expected.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{#
|
||||
/**
|
||||
* @file
|
||||
* Theme override to display all the fields in a views row.
|
||||
*
|
||||
* The reason for this template is to override the theme function provided by
|
||||
* views.
|
||||
*/
|
||||
#}
|
||||
{% include '@views/views-view-fields.html.twig' %}
|
||||
May the force be with you!
|
|
@ -0,0 +1,5 @@
|
|||
name: Views test theme
|
||||
type: theme
|
||||
description: Theme for testing Views functionality.
|
||||
version: VERSION
|
||||
core: 8.x
|
Reference in a new issue