updated core to 8.6.1 via composer
This commit is contained in:
+1
-1
@@ -601,4 +601,4 @@ display:
|
||||
- 'user.node_grants:view'
|
||||
- user.permissions
|
||||
max-age: 0
|
||||
tags: { }
|
||||
tags: { }
|
||||
|
||||
@@ -5,5 +5,5 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- views
|
||||
- entity_test
|
||||
- drupal:views
|
||||
- drupal:entity_test
|
||||
|
||||
-1
@@ -222,4 +222,3 @@ display:
|
||||
- 'user.node_grants:view'
|
||||
- user.permissions
|
||||
tags: { }
|
||||
|
||||
|
||||
-1
@@ -278,4 +278,3 @@ display:
|
||||
plugin_id: standard
|
||||
arguments: { }
|
||||
display_extenders: { }
|
||||
|
||||
|
||||
-1
@@ -35,4 +35,3 @@ display:
|
||||
display_options:
|
||||
display_extenders: { }
|
||||
path: test-menu-link
|
||||
|
||||
|
||||
+71
@@ -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
|
||||
@@ -5,4 +5,4 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- views
|
||||
- drupal:views
|
||||
|
||||
+6
@@ -37,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'];
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
@@ -35,7 +35,6 @@ class JoinTest extends JoinPluginBase {
|
||||
$this->joinValue = $join_value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
+1
-2
@@ -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.
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- views
|
||||
- drupal:views
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
|
||||
@@ -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'][] = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,4 +5,4 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- views
|
||||
- drupal:views
|
||||
|
||||
@@ -5,5 +5,5 @@ package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- views
|
||||
- language
|
||||
- drupal:views
|
||||
- drupal:language
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
@@ -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'
|
||||
@@ -4,7 +4,6 @@ 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;
|
||||
@@ -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,7 +96,7 @@ class DefaultViewsTest extends ViewTestBase {
|
||||
'status' => CommentInterface::PUBLISHED,
|
||||
'entity_id' => $node->id(),
|
||||
'entity_type' => 'node',
|
||||
'field_name' => 'comment'
|
||||
'field_name' => 'comment',
|
||||
];
|
||||
Comment::create($comment)->save();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class FilterEntityBundleTest extends ViewTestBase {
|
||||
'node.type.test_bundle_2',
|
||||
],
|
||||
'module' => [
|
||||
'node'
|
||||
'node',
|
||||
],
|
||||
];
|
||||
$this->assertIdentical($expected, $view->getDependencies());
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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';
|
||||
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
}
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
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;
|
||||
@@ -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) {
|
||||
|
||||
@@ -55,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();
|
||||
@@ -81,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.
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+1
-1
@@ -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.');
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ class DisplayAttachmentTest extends ViewTestBase {
|
||||
$this->drupalLogin($admin_user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests the attachment plugin.
|
||||
*/
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Drupal\Tests\views\Functional\Plugin;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
|
||||
use Drupal\taxonomy\Entity\Term;
|
||||
@@ -123,7 +122,7 @@ class ExposedFormCheckboxesTest extends ViewTestBase {
|
||||
}
|
||||
|
||||
// Create a field.
|
||||
$field_name = Unicode::strtolower($this->randomMachineName());
|
||||
$field_name = mb_strtolower($this->randomMachineName());
|
||||
$handler_settings = [
|
||||
'target_bundles' => [
|
||||
$this->vocabulary->id() => $this->vocabulary->id(),
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -286,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');
|
||||
|
||||
@@ -418,7 +418,7 @@ class PagerTest extends ViewTestBase {
|
||||
// Create source string.
|
||||
$source = $this->localeStorage->createString(
|
||||
[
|
||||
'source' => $label
|
||||
'source' => $label,
|
||||
]
|
||||
);
|
||||
$source->save();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
}
|
||||
@@ -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',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@ use Drupal\views\Entity\View;
|
||||
* @see views_update_8002()
|
||||
*
|
||||
* @group views
|
||||
* @group legacy
|
||||
*/
|
||||
class ArgumentPlaceholderUpdatePathTest extends UpdatePathTestBase {
|
||||
|
||||
@@ -20,7 +21,7 @@ class ArgumentPlaceholderUpdatePathTest extends UpdatePathTestBase {
|
||||
protected function setDatabaseDumpFiles() {
|
||||
$this->databaseDumpFiles = [
|
||||
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
|
||||
__DIR__ . '/../../../fixtures/update/argument-placeholder.php'
|
||||
__DIR__ . '/../../../fixtures/update/argument-placeholder.php',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use Drupal\views\Entity\View;
|
||||
* @see views_post_update_boolean_filter_values()
|
||||
*
|
||||
* @group Update
|
||||
* @group legacy
|
||||
*/
|
||||
class BooleanFilterValuesUpdateTest extends UpdatePathTestBase {
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ use Drupal\views\Entity\View;
|
||||
* Tests Views image style dependencies update.
|
||||
*
|
||||
* @group views
|
||||
* @group legacy
|
||||
*/
|
||||
class BulkFormUpdateTest extends UpdatePathTestBase {
|
||||
|
||||
@@ -18,7 +19,7 @@ class BulkFormUpdateTest extends UpdatePathTestBase {
|
||||
protected function setDatabaseDumpFiles() {
|
||||
$this->databaseDumpFiles = [
|
||||
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
|
||||
__DIR__ . '/../../../fixtures/update/legacy-bulk-form-update.php'
|
||||
__DIR__ . '/../../../fixtures/update/legacy-bulk-form-update.php',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use Drupal\views\Views;
|
||||
* @see views_post_update_update_cacheability_metadata().
|
||||
*
|
||||
* @group Update
|
||||
* @group legacy
|
||||
*/
|
||||
class CacheabilityMetadataUpdateTest extends UpdatePathTestBase {
|
||||
|
||||
|
||||
@@ -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']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace Drupal\Tests\views\Functional\Update;
|
||||
* Runs EntityViewsDataUpdateTest with a dump filled with content.
|
||||
*
|
||||
* @group Update
|
||||
* @group legacy
|
||||
*/
|
||||
class EntityViewsDataUpdateFilledTest extends EntityViewsDataUpdateTest {
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use Drupal\views\Views;
|
||||
* @see https://www.drupal.org/node/2455125
|
||||
*
|
||||
* @group Update
|
||||
* @group legacy
|
||||
*/
|
||||
class EntityViewsDataUpdateTest extends UpdatePathTestBase {
|
||||
|
||||
|
||||
+54
@@ -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']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ use Drupal\views\Entity\View;
|
||||
* @see views_post_update_cleanup_duplicate_views_data()
|
||||
*
|
||||
* @group Update
|
||||
* @group legacy
|
||||
*/
|
||||
class FieldHandlersUpdateTest extends UpdatePathTestBase {
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ use Drupal\views\Entity\View;
|
||||
* Tests Views image style dependencies update.
|
||||
*
|
||||
* @group views
|
||||
* @group legacy
|
||||
*/
|
||||
class ImageStyleDependencyUpdateTest extends UpdatePathTestBase {
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use Drupal\views\Entity\View;
|
||||
* @see views_post_update_filter_placeholder_text()
|
||||
*
|
||||
* @group Update
|
||||
* @group legacy
|
||||
*/
|
||||
class PlaceholderTextUpdateTest extends UpdatePathTestBase {
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use Drupal\views\Entity\View;
|
||||
* @see views_post_update_table_display_cache_max_age()
|
||||
*
|
||||
* @group Update
|
||||
* @group legacy
|
||||
*/
|
||||
class TableDisplayCacheMaxAgeTest extends UpdatePathTestBase {
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use Drupal\views\Views;
|
||||
* @see views_post_update_views_data_table_dependencies()
|
||||
*
|
||||
* @group Update
|
||||
* @group legacy
|
||||
*/
|
||||
class ViewsDataTableDependencyUpdateTest extends UpdatePathTestBase {
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\views\Functional;
|
||||
|
||||
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
|
||||
|
||||
/**
|
||||
* Tests the ajax view functionality.
|
||||
*
|
||||
* @group views
|
||||
*/
|
||||
class ViewAjaxTest extends ViewTestBase {
|
||||
|
||||
/**
|
||||
* Views used by this test.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $testViews = ['test_ajax_view', 'test_view'];
|
||||
|
||||
protected function setUp($import_test_views = TRUE) {
|
||||
parent::setUp($import_test_views);
|
||||
|
||||
$this->enableViewsTestModule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests an ajax view.
|
||||
*/
|
||||
public function testAjaxView() {
|
||||
$this->drupalGet('test_ajax_view');
|
||||
|
||||
$drupal_settings = $this->getDrupalSettings();
|
||||
$this->assertTrue(isset($drupal_settings['views']['ajax_path']), 'The Ajax callback path is set in drupalSettings.');
|
||||
$this->assertEqual(count($drupal_settings['views']['ajaxViews']), 1);
|
||||
$view_entry = array_keys($drupal_settings['views']['ajaxViews'])[0];
|
||||
$this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_name'], 'test_ajax_view', 'The view\'s ajaxViews array entry has the correct \'view_name\' key.');
|
||||
$this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_display_id'], 'page_1', 'The view\'s ajaxViews array entry has the correct \'view_display_id\' key.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that non-ajax view cannot be accessed via an ajax HTTP request.
|
||||
*/
|
||||
public function testNonAjaxViewViaAjax() {
|
||||
$client = $this->getHttpClient();
|
||||
$response = $client->request('POST', $this->buildUrl('views/ajax'), [
|
||||
'form_params' => ['view_name' => 'test_ajax_view', 'view_display_id' => 'default'],
|
||||
'query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax'],
|
||||
]);
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$response = $client->request('POST', $this->buildUrl('views/ajax'), [
|
||||
'form_params' => ['view_name' => 'test_view', 'view_display_id' => 'default'],
|
||||
'query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax'],
|
||||
'http_errors' => FALSE,
|
||||
]);
|
||||
$this->assertEquals(403, $response->getStatusCode());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,6 @@ class ViewRenderTest extends ViewTestBase {
|
||||
$this->enableViewsTestModule();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests render functionality.
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,6 @@ class ViewsFormMultipleTest extends ViewTestBase {
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests the a page with multiple View forms in it.
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Drupal\Tests\views\Functional\Wizard;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\views\Views;
|
||||
|
||||
@@ -196,7 +196,7 @@ class BasicTest extends WizardTestBase {
|
||||
|
||||
foreach ($displays as $display) {
|
||||
foreach (['query', 'exposed_form', 'pager', 'style', 'row'] as $type) {
|
||||
$this->assertFalse(empty($display['display_options'][$type]['options']), SafeMarkup::format('Default options found for @plugin.', ['@plugin' => $type]));
|
||||
$this->assertFalse(empty($display['display_options'][$type]['options']), new FormattableMarkup('Default options found for @plugin.', ['@plugin' => $type]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class ItemsPerPageTest extends WizardTestBase {
|
||||
// appear in the expected order.
|
||||
$this->assertUrl($view['page[path]']);
|
||||
$this->assertText($view['page[title]']);
|
||||
$content = $this->getRawContent();
|
||||
$content = $this->getSession()->getPage()->getContent();
|
||||
$this->assertText($node5->label());
|
||||
$this->assertText($node4->label());
|
||||
$this->assertText($node3->label());
|
||||
@@ -80,7 +80,7 @@ class ItemsPerPageTest extends WizardTestBase {
|
||||
$this->drupalPlaceBlock("views_block:{$view['id']}-block_1");
|
||||
|
||||
$this->drupalGet('user');
|
||||
$content = $this->getRawContent();
|
||||
$content = $this->getSession()->getPage()->getContent();
|
||||
$this->assertText($node5->label());
|
||||
$this->assertText($node4->label());
|
||||
$this->assertText($node3->label());
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Drupal\Tests\views\Functional\Wizard;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ class MenuTest extends WizardTestBase {
|
||||
/** @var \Drupal\Core\Menu\MenuLinkInterface $link */
|
||||
$link = $menu_link_manager->createInstance('views_view:views.' . $view['id'] . '.page_1');
|
||||
$url = $link->getUrlObject();
|
||||
$this->assertEqual($url->getRouteName(), 'view.' . $view['id'] . '.page_1', SafeMarkup::format('Found a link to %path in the main menu', ['%path' => $view['page[path]']]));
|
||||
$this->assertEqual($url->getRouteName(), 'view.' . $view['id'] . '.page_1', new FormattableMarkup('Found a link to %path in the main menu', ['%path' => $view['page[path]']]));
|
||||
$metadata = $link->getMetaData();
|
||||
$this->assertEqual(['view_id' => $view['id'], 'display_id' => 'page_1'], $metadata);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class SortingTest extends WizardTestBase {
|
||||
// Make sure the view shows the nodes in the expected order.
|
||||
$this->assertUrl($view1['page[path]']);
|
||||
$this->assertText($view1['page[title]']);
|
||||
$content = $this->getRawContent();
|
||||
$content = $this->getSession()->getPage()->getContent();
|
||||
$this->assertText($node1->label());
|
||||
$this->assertText($node2->label());
|
||||
$this->assertText($node3->label());
|
||||
@@ -67,7 +67,7 @@ class SortingTest extends WizardTestBase {
|
||||
// Make sure the view shows the nodes in the expected order.
|
||||
$this->assertUrl($view2['page[path]']);
|
||||
$this->assertText($view2['page[title]']);
|
||||
$content = $this->getRawContent();
|
||||
$content = $this->getSession()->getPage()->getContent();
|
||||
$this->assertText($node3->label());
|
||||
$this->assertText($node2->label());
|
||||
$this->assertText($node1->label());
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Drupal\Tests\views\FunctionalJavascript;
|
||||
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
use Drupal\simpletest\ContentTypeCreationTrait;
|
||||
use Drupal\simpletest\NodeCreationTrait;
|
||||
use Drupal\views\Tests\ViewTestData;
|
||||
@@ -12,7 +12,7 @@ use Drupal\views\Tests\ViewTestData;
|
||||
*
|
||||
* @group views
|
||||
*/
|
||||
class ClickSortingAJAXTest extends JavascriptTestBase {
|
||||
class ClickSortingAJAXTest extends WebDriverTestBase {
|
||||
|
||||
use ContentTypeCreationTrait;
|
||||
use NodeCreationTrait;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Drupal\Tests\views\FunctionalJavascript;
|
||||
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
use Drupal\simpletest\ContentTypeCreationTrait;
|
||||
use Drupal\simpletest\NodeCreationTrait;
|
||||
|
||||
@@ -11,7 +11,7 @@ use Drupal\simpletest\NodeCreationTrait;
|
||||
*
|
||||
* @group views
|
||||
*/
|
||||
class ExposedFilterAJAXTest extends JavascriptTestBase {
|
||||
class ExposedFilterAJAXTest extends WebDriverTestBase {
|
||||
|
||||
use ContentTypeCreationTrait;
|
||||
use NodeCreationTrait;
|
||||
@@ -19,12 +19,14 @@ class ExposedFilterAJAXTest extends JavascriptTestBase {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['node', 'views'];
|
||||
public static $modules = ['node', 'views', 'views_test_modal'];
|
||||
|
||||
/**
|
||||
* Tests if exposed filtering via AJAX works for the "Content" View.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function testExposedFiltering() {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Enable AJAX on the /admin/content View.
|
||||
\Drupal::configFactory()->getEditable('views.view.content')
|
||||
->set('display.default.display_options.use_ajax', TRUE)
|
||||
@@ -40,9 +42,15 @@ class ExposedFilterAJAXTest extends JavascriptTestBase {
|
||||
'administer site configuration',
|
||||
'access content',
|
||||
'access content overview',
|
||||
'edit any page content',
|
||||
]);
|
||||
$this->drupalLogin($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if exposed filtering via AJAX works for the "Content" View.
|
||||
*/
|
||||
public function testExposedFiltering() {
|
||||
// Visit the View page.
|
||||
$this->drupalGet('admin/content');
|
||||
|
||||
@@ -71,6 +79,16 @@ class ExposedFilterAJAXTest extends JavascriptTestBase {
|
||||
$this->assertContains('Page Two', $html);
|
||||
$this->assertNotContains('Page One', $html);
|
||||
|
||||
// Submit bulk actions form to ensure that the previous AJAX submit does not
|
||||
// break it.
|
||||
$this->submitForm([
|
||||
'action' => 'node_make_sticky_action',
|
||||
'node_bulk_form[0]' => TRUE,
|
||||
], t('Apply to selected items'));
|
||||
|
||||
// Verify that the action was performed.
|
||||
$this->assertSession()->pageTextContains('Make content sticky was applied to 1 item.');
|
||||
|
||||
// Reset the form.
|
||||
$this->submitForm([], t('Reset'));
|
||||
$this->assertSession()->assertWaitOnAjaxRequest();
|
||||
@@ -80,4 +98,52 @@ class ExposedFilterAJAXTest extends JavascriptTestBase {
|
||||
$this->assertFalse($session->getPage()->hasButton('Reset'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if exposed filtering via AJAX works in a modal.
|
||||
*/
|
||||
public function testExposedFiltersInModal() {
|
||||
$this->drupalGet('views-test-modal/modal');
|
||||
|
||||
$assert = $this->assertSession();
|
||||
|
||||
$assert->elementExists('named', ['link', 'Administer content'])->click();
|
||||
$dialog = $assert->waitForElementVisible('css', '.views-test-modal');
|
||||
|
||||
$session = $this->getSession();
|
||||
// Ensure that the Content we're testing for is present.
|
||||
$html = $session->getPage()->getHtml();
|
||||
$this->assertContains('Page One', $html);
|
||||
$this->assertContains('Page Two', $html);
|
||||
|
||||
// Search for "Page One".
|
||||
$session->getPage()->fillField('title', 'Page One');
|
||||
$assert->elementExists('css', '.ui-dialog-buttonpane')->pressButton('Filter');
|
||||
$this->assertSession()->assertWaitOnAjaxRequest();
|
||||
|
||||
// Verify that only the "Page One" Node is present.
|
||||
$html = $session->getPage()->getHtml();
|
||||
$this->assertContains('Page One', $html);
|
||||
$this->assertNotContains('Page Two', $html);
|
||||
|
||||
// Close and re-open the modal.
|
||||
$assert->buttonExists('Close', $dialog)->press();
|
||||
$assert->elementExists('named', ['link', 'Administer content'])->click();
|
||||
$assert->waitForElementVisible('css', '.views-test-modal');
|
||||
|
||||
// Ensure that the Content we're testing for is present.
|
||||
$html = $session->getPage()->getHtml();
|
||||
$this->assertContains('Page One', $html);
|
||||
$this->assertContains('Page Two', $html);
|
||||
|
||||
// Search for "Page One".
|
||||
$session->getPage()->fillField('title', 'Page One');
|
||||
$assert->elementExists('css', '.ui-dialog-buttonpane')->pressButton('Filter');
|
||||
$this->assertSession()->assertWaitOnAjaxRequest();
|
||||
|
||||
// Verify that only the "Page One" Node is present.
|
||||
$html = $session->getPage()->getHtml();
|
||||
$this->assertContains('Page One', $html);
|
||||
$this->assertNotContains('Page Two', $html);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Drupal\Tests\views\FunctionalJavascript;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
use Drupal\language\Entity\ConfigurableLanguage;
|
||||
use Drupal\simpletest\ContentTypeCreationTrait;
|
||||
use Drupal\simpletest\NodeCreationTrait;
|
||||
@@ -14,7 +14,7 @@ use Drupal\views\Tests\ViewTestData;
|
||||
*
|
||||
* @group node
|
||||
*/
|
||||
class GlossaryViewTest extends JavascriptTestBase {
|
||||
class GlossaryViewTest extends WebDriverTestBase {
|
||||
|
||||
use ContentTypeCreationTrait;
|
||||
use NodeCreationTrait;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Drupal\Tests\views\FunctionalJavascript;
|
||||
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
use Drupal\simpletest\ContentTypeCreationTrait;
|
||||
use Drupal\simpletest\NodeCreationTrait;
|
||||
use Drupal\views\Tests\ViewTestData;
|
||||
@@ -12,7 +12,7 @@ use Drupal\views\Tests\ViewTestData;
|
||||
*
|
||||
* @group views
|
||||
*/
|
||||
class PaginationAJAXTest extends JavascriptTestBase {
|
||||
class PaginationAJAXTest extends WebDriverTestBase {
|
||||
|
||||
use ContentTypeCreationTrait;
|
||||
use NodeCreationTrait;
|
||||
@@ -86,6 +86,10 @@ class PaginationAJAXTest extends JavascriptTestBase {
|
||||
$rows = $page->findAll('css', 'tbody tr');
|
||||
$this->assertCount(5, $rows);
|
||||
$this->assertContains('Node 6 content', $rows[0]->getHtml());
|
||||
$link = $page->findLink('Go to page 3');
|
||||
// Test that no unwanted parameters are added to the URL.
|
||||
$this->assertEquals('?status=All&type=All&langcode=All&items_per_page=5&order=changed&sort=asc&title=&page=2', $link->getAttribute('href'));
|
||||
$this->assertNoDuplicateAssetsOnPage();
|
||||
|
||||
$this->clickLink('Go to page 3');
|
||||
$session_assert->assertWaitOnAjaxRequest();
|
||||
@@ -115,4 +119,17 @@ class PaginationAJAXTest extends JavascriptTestBase {
|
||||
$this->assertContains('Node 11 content', $rows[0]->getHtml());
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that assets are not loaded twice on a page.
|
||||
*/
|
||||
protected function assertNoDuplicateAssetsOnPage() {
|
||||
/** @var \Behat\Mink\Element\NodeElement[] $scripts */
|
||||
$scripts = $this->getSession()->getPage()->findAll('xpath', '//script');
|
||||
$script_src = [];
|
||||
foreach ($scripts as $script) {
|
||||
$this->assertFalse(in_array($script->getAttribute('src'), $script_src));
|
||||
$script_src[] = $script->getAttribute('src');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler;
|
||||
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
use Drupal\views\Tests\ViewTestData;
|
||||
|
||||
/**
|
||||
@@ -10,7 +10,7 @@ use Drupal\views\Tests\ViewTestData;
|
||||
*
|
||||
* @group views
|
||||
*/
|
||||
class ContextualFilterTest extends JavascriptTestBase {
|
||||
class ContextualFilterTest extends WebDriverTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ namespace Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler;
|
||||
|
||||
use Drupal\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\views\Tests\ViewTestData;
|
||||
|
||||
@@ -13,7 +13,7 @@ use Drupal\views\Tests\ViewTestData;
|
||||
*
|
||||
* @group views
|
||||
*/
|
||||
class FieldTest extends JavascriptTestBase {
|
||||
class FieldTest extends WebDriverTestBase {
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
namespace Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler;
|
||||
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\views\Tests\ViewTestData;
|
||||
|
||||
@@ -12,7 +12,7 @@ use Drupal\views\Tests\ViewTestData;
|
||||
*
|
||||
* @group views
|
||||
*/
|
||||
class GroupedExposedFilterTest extends JavascriptTestBase {
|
||||
class GroupedExposedFilterTest extends WebDriverTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Drupal\Tests\views\Kernel\Entity;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
@@ -56,7 +55,7 @@ class ViewEntityDependenciesTest extends ViewsKernelTestBase {
|
||||
]);
|
||||
$content_type->save();
|
||||
$field_storage = FieldStorageConfig::create([
|
||||
'field_name' => Unicode::strtolower($this->randomMachineName()),
|
||||
'field_name' => mb_strtolower($this->randomMachineName()),
|
||||
'entity_type' => 'node',
|
||||
'type' => 'comment',
|
||||
]);
|
||||
@@ -90,7 +89,7 @@ class ViewEntityDependenciesTest extends ViewsKernelTestBase {
|
||||
'comment',
|
||||
'node',
|
||||
'user',
|
||||
]
|
||||
],
|
||||
];
|
||||
// Tests dependencies of relationships.
|
||||
$expected['test_relationship_dependency'] = [
|
||||
@@ -98,7 +97,7 @@ class ViewEntityDependenciesTest extends ViewsKernelTestBase {
|
||||
'comment',
|
||||
'node',
|
||||
'user',
|
||||
]
|
||||
],
|
||||
];
|
||||
$expected['test_plugin_dependencies'] = [
|
||||
'module' => [
|
||||
@@ -109,24 +108,24 @@ class ViewEntityDependenciesTest extends ViewsKernelTestBase {
|
||||
'RowTest',
|
||||
'StaticTest',
|
||||
'StyleTest',
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
$expected['test_argument_dependency'] = [
|
||||
'config' => [
|
||||
'core.entity_view_mode.node.teaser',
|
||||
'field.storage.node.body'
|
||||
'field.storage.node.body',
|
||||
],
|
||||
'content' => [
|
||||
'ArgumentDefaultTest',
|
||||
'ArgumentValidatorTest'
|
||||
'ArgumentValidatorTest',
|
||||
],
|
||||
'module' => [
|
||||
'node',
|
||||
// The argument handler is provided by the search module.
|
||||
'search',
|
||||
'text',
|
||||
'user'
|
||||
'user',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -146,25 +145,25 @@ class ViewEntityDependenciesTest extends ViewsKernelTestBase {
|
||||
],
|
||||
'content' => [
|
||||
'ArgumentDefaultTest',
|
||||
'ArgumentValidatorTest'
|
||||
'ArgumentValidatorTest',
|
||||
],
|
||||
'module' => [
|
||||
'core',
|
||||
'node',
|
||||
'search',
|
||||
'user',
|
||||
'views'
|
||||
'views',
|
||||
],
|
||||
];
|
||||
$expected_display['page'] = [
|
||||
'config' => [
|
||||
'field.storage.node.body'
|
||||
'field.storage.node.body',
|
||||
],
|
||||
'module' => [
|
||||
'core',
|
||||
'node',
|
||||
'text',
|
||||
'views'
|
||||
'views',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ namespace Drupal\Tests\views\Kernel\EventSubscriber;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeEvent;
|
||||
use Drupal\Core\Entity\EntityTypeEvents;
|
||||
use Drupal\system\Tests\Entity\EntityDefinitionTestTrait;
|
||||
use Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait;
|
||||
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,8 +35,8 @@ class AreaEmptyTest extends ViewsKernelTestBase {
|
||||
'title' => 'Test Example area',
|
||||
'help' => 'A area handler which just exists for tests.',
|
||||
'area' => [
|
||||
'id' => 'test_example'
|
||||
]
|
||||
'id' => 'test_example',
|
||||
],
|
||||
];
|
||||
|
||||
return $data;
|
||||
|
||||
@@ -24,7 +24,7 @@ class AreaMessagesTest extends ViewsKernelTestBase {
|
||||
* Tests the messages area handler.
|
||||
*/
|
||||
public function testMessageText() {
|
||||
drupal_set_message('My drupal set message.');
|
||||
\Drupal::messenger()->addStatus('My drupal set message.');
|
||||
|
||||
$view = Views::getView('test_area_messages');
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ class AreaResultTest extends ViewsKernelTestBase {
|
||||
$output = \Drupal::service('renderer')->renderRoot($output);
|
||||
$this->setRawContent($output);
|
||||
$this->assertText('start: 0 | end: 0 | total: 0 | label: test_area_result | per page: 0 | current page: 1 | current record count: 0 | page count: 1');
|
||||
$this->assertRaw('<header>');
|
||||
|
||||
// Test that the area is not displayed if we have not checked the empty
|
||||
// checkbox.
|
||||
@@ -67,6 +68,8 @@ class AreaResultTest extends ViewsKernelTestBase {
|
||||
$output = \Drupal::service('renderer')->renderRoot($output);
|
||||
$this->setRawContent($output);
|
||||
$this->assertNoText('start: 0 | end: 0 | total: 0 | label: test_area_result | per page: 0 | current page: 1 | current record count: 0 | page count: 1');
|
||||
// Make sure the empty header region isn't rendered.
|
||||
$this->assertNoRaw('<header>');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ class ComputedFieldTest extends ViewsKernelTestBase {
|
||||
*/
|
||||
public static $modules = ['entity_test'];
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
@@ -62,7 +62,7 @@ class FieldCounterTest extends ViewsKernelTestBase {
|
||||
'table' => 'views',
|
||||
'field' => 'counter',
|
||||
'relationship' => 'none',
|
||||
'counter_start' => $rand_start
|
||||
'counter_start' => $rand_start,
|
||||
],
|
||||
'name' => [
|
||||
'id' => 'name',
|
||||
|
||||
@@ -82,7 +82,7 @@ class FieldFieldTest extends ViewsKernelTestBase {
|
||||
$this->testUsers[$i] = User::create([
|
||||
'name' => 'test ' . $i,
|
||||
'timezone' => User::getAllowedTimezones()[$i],
|
||||
'created' => REQUEST_TIME - rand(0, 3600)
|
||||
'created' => REQUEST_TIME - rand(0, 3600),
|
||||
]);
|
||||
$this->testUsers[$i]->save();
|
||||
}
|
||||
@@ -279,8 +279,8 @@ class FieldFieldTest extends ViewsKernelTestBase {
|
||||
$render = $executable->display_handler->render();
|
||||
$expected_attachments = [
|
||||
'library' => [
|
||||
'views/views.module'
|
||||
]
|
||||
'views/views.module',
|
||||
],
|
||||
];
|
||||
foreach ($this->entities as $entity) {
|
||||
$expected_attachments['library'][] = 'foo/fake_library';
|
||||
|
||||
@@ -100,7 +100,7 @@ class FieldKernelTest extends ViewsKernelTestBase {
|
||||
* The value to search for.
|
||||
* @param string $message
|
||||
* (optional) A message to display with the assertion. Do not translate
|
||||
* messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed
|
||||
* messages: use \Drupal\Component\Render\FormattableMarkup to embed
|
||||
* variables in the message text, not t(). If left blank, a default message
|
||||
* will be displayed.
|
||||
* @param string $group
|
||||
@@ -125,7 +125,7 @@ class FieldKernelTest extends ViewsKernelTestBase {
|
||||
* The value to search for.
|
||||
* @param string $message
|
||||
* (optional) A message to display with the assertion. Do not translate
|
||||
* messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed
|
||||
* messages: use \Drupal\Component\Render\FormattableMarkup to embed
|
||||
* variables in the message text, not t(). If left blank, a default message
|
||||
* will be displayed.
|
||||
* @param string $group
|
||||
@@ -809,7 +809,7 @@ class FieldKernelTest extends ViewsKernelTestBase {
|
||||
'khoảng cách từ đại lí đến',
|
||||
'của hãng bao gồm ba dòng',
|
||||
'сд асд асд ас',
|
||||
'асд асд асд ас'
|
||||
'асд асд асд ас',
|
||||
];
|
||||
// Just test maxlength without word boundary.
|
||||
$alter = [
|
||||
|
||||
@@ -146,7 +146,6 @@ class FilterEqualityTest extends ViewsKernelTestBase {
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->columnMap);
|
||||
}
|
||||
|
||||
|
||||
protected function getGroupedExposedFilters() {
|
||||
$filters = [
|
||||
'name' => [
|
||||
|
||||
@@ -222,7 +222,6 @@ class FilterStringTest extends ViewsKernelTestBase {
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->columnMap);
|
||||
}
|
||||
|
||||
|
||||
public function testFilterStringGroupedExposedContains() {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
@@ -245,7 +244,6 @@ class FilterStringTest extends ViewsKernelTestBase {
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->columnMap);
|
||||
}
|
||||
|
||||
|
||||
public function testFilterStringWord() {
|
||||
$view = Views::getView('test_view');
|
||||
$view->setDisplay();
|
||||
@@ -334,7 +332,6 @@ class FilterStringTest extends ViewsKernelTestBase {
|
||||
$this->assertIdenticalResultset($view, $resultset);
|
||||
}
|
||||
|
||||
|
||||
public function testFilterStringGroupedExposedWord() {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
@@ -618,7 +615,6 @@ class FilterStringTest extends ViewsKernelTestBase {
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->columnMap);
|
||||
}
|
||||
|
||||
|
||||
public function testFilterStringGroupedExposedNot() {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
@@ -741,7 +737,6 @@ class FilterStringTest extends ViewsKernelTestBase {
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->columnMap);
|
||||
}
|
||||
|
||||
|
||||
public function testFilterStringEmpty() {
|
||||
$view = Views::getView('test_view');
|
||||
$view->setDisplay();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Drupal\Tests\views\Kernel\Handler;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
|
||||
use Drupal\views\Views;
|
||||
|
||||
@@ -193,7 +193,7 @@ class SortDateTest extends ViewsKernelTestBase {
|
||||
$this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
|
||||
$this->assertIdenticalResultset($view, $this->expectedResultSet($granularity, $reverse), [
|
||||
'views_test_data_name' => 'name',
|
||||
], SafeMarkup::format('Result is returned correctly when ordering by granularity @granularity, @reverse.', ['@granularity' => $granularity, '@reverse' => $reverse ? 'reverse' : 'forward']));
|
||||
], new FormattableMarkup('Result is returned correctly when ordering by granularity @granularity, @reverse.', ['@granularity' => $granularity, '@reverse' => $reverse ? 'reverse' : 'forward']));
|
||||
$view->destroy();
|
||||
unset($view);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class SortTranslationTest extends ViewsKernelTestBase {
|
||||
'entity_type' => 'node',
|
||||
'bundle' => 'article',
|
||||
'label' => 'Translated text',
|
||||
'translatable' => TRUE
|
||||
'translatable' => TRUE,
|
||||
])->save();
|
||||
|
||||
FieldStorageConfig::create([
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Drupal\Tests\views\Kernel;
|
||||
*/
|
||||
use Drupal\views\Plugin\views\filter\Standard;
|
||||
use Drupal\views\Views;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
|
||||
class ModuleTest extends ViewsKernelTestBase {
|
||||
@@ -29,7 +28,7 @@ class ModuleTest extends ViewsKernelTestBase {
|
||||
public static $modules = ['field', 'user', 'block'];
|
||||
|
||||
/**
|
||||
* Stores the last triggered error, for example via debug().
|
||||
* Stores the last triggered error.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
@@ -256,7 +255,7 @@ class ModuleTest extends ViewsKernelTestBase {
|
||||
list($plugin_type, $plugin_id) = explode(':', $key);
|
||||
$plugin_def = $this->container->get("plugin.manager.views.$plugin_type")->getDefinition($plugin_id);
|
||||
|
||||
$this->assertTrue(isset($plugin_list[$key]), SafeMarkup::format('The expected @key plugin list key was found.', ['@key' => $key]));
|
||||
$this->assertTrue(isset($plugin_list[$key]), new FormattableMarkup('The expected @key plugin list key was found.', ['@key' => $key]));
|
||||
$plugin_details = $plugin_list[$key];
|
||||
|
||||
$this->assertEqual($plugin_details['type'], $plugin_type, 'The expected plugin type was found.');
|
||||
|
||||
@@ -41,8 +41,8 @@ class ArgumentValidatorTest extends ViewsKernelTestBase {
|
||||
$options = [
|
||||
'specify_validation' => TRUE,
|
||||
'validate' => [
|
||||
'type' => 'argument_validator_test'
|
||||
]
|
||||
'type' => 'argument_validator_test',
|
||||
],
|
||||
];
|
||||
$id = $view->addHandler('default', 'argument', 'views_test_data', 'name', $options);
|
||||
$view->initHandlers();
|
||||
|
||||
@@ -37,7 +37,7 @@ class BlockDependenciesTest extends ViewsKernelTestBase {
|
||||
$expected = [
|
||||
'config' => ['views.view.test_exposed_block'],
|
||||
'module' => ['views'],
|
||||
'theme' => ['stark']
|
||||
'theme' => ['stark'],
|
||||
];
|
||||
$this->assertIdentical($expected, $dependencies);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class BlockDependenciesTest extends ViewsKernelTestBase {
|
||||
$expected = [
|
||||
'config' => ['views.view.content_recent'],
|
||||
'module' => ['views'],
|
||||
'theme' => ['stark']
|
||||
'theme' => ['stark'],
|
||||
];
|
||||
$this->assertIdentical($expected, $dependencies);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ class CacheTest extends ViewsKernelTestBase {
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests time based caching.
|
||||
*
|
||||
@@ -75,7 +74,7 @@ class CacheTest extends ViewsKernelTestBase {
|
||||
'options' => [
|
||||
'results_lifespan' => '3600',
|
||||
'output_lifespan' => '3600',
|
||||
]
|
||||
],
|
||||
]);
|
||||
|
||||
// Test the default (non-paged) display.
|
||||
@@ -189,7 +188,7 @@ class CacheTest extends ViewsKernelTestBase {
|
||||
'options' => [
|
||||
'results_lifespan' => '3600',
|
||||
'output_lifespan' => '3600',
|
||||
]
|
||||
],
|
||||
]);
|
||||
|
||||
$mapping = ['views_test_data_name' => 'name'];
|
||||
@@ -272,7 +271,7 @@ class CacheTest extends ViewsKernelTestBase {
|
||||
'type' => 'time',
|
||||
'options' => [
|
||||
'output_lifespan' => '3600',
|
||||
]
|
||||
],
|
||||
]);
|
||||
|
||||
$output = $view->buildRenderable();
|
||||
@@ -331,7 +330,7 @@ class CacheTest extends ViewsKernelTestBase {
|
||||
'options' => [
|
||||
'results_lifespan' => '3600',
|
||||
'output_lifespan' => '3600',
|
||||
]
|
||||
],
|
||||
]);
|
||||
$this->executeView($view);
|
||||
|
||||
@@ -393,9 +392,9 @@ class CacheTest extends ViewsKernelTestBase {
|
||||
$options = [
|
||||
'default_argument_type' => 'argument_default_test',
|
||||
'default_argument_options' => [
|
||||
'value' => 'John'
|
||||
'value' => 'John',
|
||||
],
|
||||
'default_action' => 'default'
|
||||
'default_action' => 'default',
|
||||
];
|
||||
$view->addHandler('default', 'argument', 'views_test_data', 'name', $options);
|
||||
$view->initHandlers();
|
||||
|
||||
@@ -17,7 +17,7 @@ class ViewsMenuLinkTest extends ViewsKernelTestBase {
|
||||
public static $modules = [
|
||||
'menu_ui',
|
||||
'user',
|
||||
'views'
|
||||
'views',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,7 @@ class DisplayPageTest extends ViewsKernelTestBase {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['system', 'user', 'field'];
|
||||
public static $modules = ['system', 'user', 'field', 'views_test_data'];
|
||||
|
||||
/**
|
||||
* The router dumper to get all routes.
|
||||
@@ -220,4 +220,40 @@ class DisplayPageTest extends ViewsKernelTestBase {
|
||||
$this->assertTrue($view->getDisplay()->getOption('use_more_always'), 'Always display the more link by default.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the templates with empty rows.
|
||||
*/
|
||||
public function testEmptyRow() {
|
||||
$view = Views::getView('test_page_display');
|
||||
$view->initDisplay();
|
||||
$view->newDisplay('page', 'Page', 'empty_row');
|
||||
$view->save();
|
||||
|
||||
$styles = [
|
||||
'default' => '//div[@class="views-row"]',
|
||||
'grid' => '//div[contains(@class, "views-col")]',
|
||||
'html_list' => '//div[@class="item-list"]//li',
|
||||
];
|
||||
|
||||
$themes = ['bartik', 'classy', 'seven', 'stable', 'stark'];
|
||||
|
||||
foreach ($themes as $theme) {
|
||||
\Drupal::service('theme_handler')->install([$theme]);
|
||||
\Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme($theme));
|
||||
foreach ($styles as $type => $xpath) {
|
||||
$view = Views::getView('test_page_display');
|
||||
$view->storage->invalidateCaches();
|
||||
$view->initDisplay();
|
||||
$view->setDisplay('empty_row');
|
||||
$view->displayHandlers->get('empty_row')->default_display->options['style']['type'] = $type;
|
||||
$view->initStyle();
|
||||
$this->executeView($view);
|
||||
$output = $view->preview();
|
||||
$output = \Drupal::service('renderer')->renderRoot($output);
|
||||
$this->setRawContent($output);
|
||||
$this->assertCount(5, $this->xpath("{$xpath}[not(text()) and not(node())]"), "Empty rows in theme '$theme', type '$type'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
namespace Drupal\Tests\views\Kernel\Plugin;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
|
||||
use Drupal\views\Views;
|
||||
|
||||
/**
|
||||
* Tests the exposed form markup.
|
||||
* Tests the exposed form.
|
||||
*
|
||||
* @group views
|
||||
* @see \Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest
|
||||
@@ -52,4 +53,92 @@ class ExposedFormRenderTest extends ViewsKernelTestBase {
|
||||
$this->assertEqual(count($result), 1, 'Filter description was found.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the exposed form raw input.
|
||||
*/
|
||||
public function testExposedFormRawInput() {
|
||||
$node_type = NodeType::create(['type' => 'article']);
|
||||
$node_type->save();
|
||||
|
||||
$view = Views::getView('test_exposed_form_buttons');
|
||||
$view->setDisplay();
|
||||
$view->displayHandlers->get('default')->overrideOption('filters', [
|
||||
'type' => [
|
||||
'exposed' => TRUE,
|
||||
'field' => 'type',
|
||||
'id' => 'type',
|
||||
'table' => 'node_field_data',
|
||||
'plugin_id' => 'in_operator',
|
||||
'entity_type' => 'node',
|
||||
'entity_field' => 'type',
|
||||
'expose' => [
|
||||
'identifier' => 'type',
|
||||
'label' => 'Content: Type',
|
||||
'operator_id' => 'type_op',
|
||||
'reduce' => FALSE,
|
||||
'multiple' => FALSE,
|
||||
],
|
||||
],
|
||||
'type_with_default_value' => [
|
||||
'exposed' => TRUE,
|
||||
'field' => 'type',
|
||||
'id' => 'type_with_default_value',
|
||||
'table' => 'node_field_data',
|
||||
'plugin_id' => 'in_operator',
|
||||
'entity_type' => 'node',
|
||||
'entity_field' => 'type',
|
||||
'value' => ['article', 'article'],
|
||||
'expose' => [
|
||||
'identifier' => 'type_with_default_value',
|
||||
'label' => 'Content: Type with value',
|
||||
'operator_id' => 'type_op',
|
||||
'reduce' => FALSE,
|
||||
'multiple' => FALSE,
|
||||
],
|
||||
],
|
||||
'multiple_types' => [
|
||||
'exposed' => TRUE,
|
||||
'field' => 'type',
|
||||
'id' => 'multiple_types',
|
||||
'table' => 'node_field_data',
|
||||
'plugin_id' => 'in_operator',
|
||||
'entity_type' => 'node',
|
||||
'entity_field' => 'type',
|
||||
'expose' => [
|
||||
'identifier' => 'multiple_types',
|
||||
'label' => 'Content: Type (multiple)',
|
||||
'operator_id' => 'type_op',
|
||||
'reduce' => FALSE,
|
||||
'multiple' => TRUE,
|
||||
],
|
||||
],
|
||||
'multiple_types_with_default_value' => [
|
||||
'exposed' => TRUE,
|
||||
'field' => 'type',
|
||||
'id' => 'multiple_types_with_default_value',
|
||||
'table' => 'node_field_data',
|
||||
'plugin_id' => 'in_operator',
|
||||
'entity_type' => 'node',
|
||||
'entity_field' => 'type',
|
||||
'value' => ['article', 'article'],
|
||||
'expose' => [
|
||||
'identifier' => 'multiple_types_with_default_value',
|
||||
'label' => 'Content: Type with default value (multiple)',
|
||||
'operator_id' => 'type_op',
|
||||
'reduce' => FALSE,
|
||||
'multiple' => TRUE,
|
||||
],
|
||||
],
|
||||
]);
|
||||
$view->save();
|
||||
$this->executeView($view);
|
||||
|
||||
$expected = [
|
||||
'type' => 'All',
|
||||
'type_with_default_value' => 'article',
|
||||
'multiple_types_with_default_value' => ['article'],
|
||||
];
|
||||
$this->assertSame($view->exposed_raw_input, $expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -88,12 +88,12 @@ class FieldOrLanguageJoinTest extends RelationshipJoinTestBase {
|
||||
$configuration['extra'] = [
|
||||
[
|
||||
'field' => 'name',
|
||||
'value' => $random_name_1
|
||||
'value' => $random_name_1,
|
||||
],
|
||||
[
|
||||
'field' => 'name',
|
||||
'value' => $random_name_2,
|
||||
'operator' => '<>'
|
||||
'operator' => '<>',
|
||||
],
|
||||
];
|
||||
$join_info = $this->buildJoin($view, $configuration, 'users3');
|
||||
@@ -110,7 +110,7 @@ class FieldOrLanguageJoinTest extends RelationshipJoinTestBase {
|
||||
$configuration['extra'] = [
|
||||
[
|
||||
'field' => 'name',
|
||||
'value' => $random_name_1
|
||||
'value' => $random_name_1,
|
||||
],
|
||||
[
|
||||
'field' => 'name',
|
||||
|
||||
@@ -129,12 +129,12 @@ class JoinTest extends RelationshipJoinTestBase {
|
||||
$configuration['extra'] = [
|
||||
[
|
||||
'field' => 'name',
|
||||
'value' => $random_name_1
|
||||
'value' => $random_name_1,
|
||||
],
|
||||
[
|
||||
'field' => 'name',
|
||||
'value' => $random_name_2,
|
||||
'operator' => '<>'
|
||||
'operator' => '<>',
|
||||
],
|
||||
];
|
||||
$join = $this->manager->createInstance('standard', $configuration);
|
||||
@@ -156,7 +156,7 @@ class JoinTest extends RelationshipJoinTestBase {
|
||||
$configuration['extra'] = [
|
||||
[
|
||||
'field' => 'name',
|
||||
'value' => $random_name_1
|
||||
'value' => $random_name_1,
|
||||
],
|
||||
[
|
||||
'field' => 'name',
|
||||
@@ -178,7 +178,7 @@ class JoinTest extends RelationshipJoinTestBase {
|
||||
$configuration['extra'] = [
|
||||
[
|
||||
'field' => 'langcode',
|
||||
'value' => 'en'
|
||||
'value' => 'en',
|
||||
],
|
||||
[
|
||||
'left_field' => 'status',
|
||||
@@ -187,7 +187,7 @@ class JoinTest extends RelationshipJoinTestBase {
|
||||
],
|
||||
[
|
||||
'field' => 'name',
|
||||
'left_field' => 'name'
|
||||
'left_field' => 'name',
|
||||
],
|
||||
];
|
||||
$join = $this->manager->createInstance('standard', $configuration);
|
||||
|
||||
@@ -55,7 +55,7 @@ abstract class RelationshipJoinTestBase extends PluginKernelTestBase {
|
||||
'type' => 'int',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
'default' => 0
|
||||
'default' => 0,
|
||||
];
|
||||
|
||||
return $schema;
|
||||
@@ -74,8 +74,8 @@ abstract class RelationshipJoinTestBase extends PluginKernelTestBase {
|
||||
'relationship' => [
|
||||
'id' => 'standard',
|
||||
'base' => 'users_field_data',
|
||||
'base field' => 'uid'
|
||||
]
|
||||
'base field' => 'uid',
|
||||
],
|
||||
];
|
||||
|
||||
return $data;
|
||||
|
||||
@@ -78,8 +78,8 @@ class RelationshipTest extends RelationshipJoinTestBase {
|
||||
$expected_result = [
|
||||
[
|
||||
'name' => 'John',
|
||||
'uid' => 1
|
||||
]
|
||||
'uid' => 1,
|
||||
],
|
||||
];
|
||||
$this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
|
||||
$view->destroy();
|
||||
@@ -101,8 +101,8 @@ class RelationshipTest extends RelationshipJoinTestBase {
|
||||
$expected_result = [
|
||||
[
|
||||
'name' => 'John',
|
||||
'uid' => 1
|
||||
]
|
||||
'uid' => 1,
|
||||
],
|
||||
];
|
||||
$this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
|
||||
$view->destroy();
|
||||
|
||||
@@ -69,7 +69,7 @@ class SqlEntityLoadingTest extends ViewsKernelTestBase {
|
||||
'nid' => $node->id(),
|
||||
// The default revision ID.
|
||||
'vid_1' => $revision->getRevisionId(),
|
||||
// THe latest revision ID.
|
||||
// The latest revision ID.
|
||||
'vid' => $revision2->getRevisionId(),
|
||||
],
|
||||
];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user