Update to Drupal 8.1.1. For more information, see https://www.drupal.org/node/2718713
This commit is contained in:
parent
c0a0d5a94c
commit
9eae24d844
669 changed files with 3873 additions and 1553 deletions
|
@ -163,7 +163,7 @@ class FieldFieldTest extends ViewsKernelTestBase {
|
|||
'name' => 'base value',
|
||||
'field_test' => 1,
|
||||
'field_test_multiple' => [1, 3, 7],
|
||||
'user_id' => $this->testUsers[0]->id(),
|
||||
'user_id' => $this->testUsers[0]->id(),
|
||||
]);
|
||||
$entity->save();
|
||||
$original_entity = clone $entity;
|
||||
|
|
|
@ -215,4 +215,3 @@ class FilterBooleanOperatorTest extends ViewsKernelTestBase {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -115,6 +115,8 @@ class ModuleTest extends ViewsKernelTestBase {
|
|||
/**
|
||||
* Defines an error handler which is used in the test.
|
||||
*
|
||||
* Because this is registered in set_error_handler(), it has to be public.
|
||||
*
|
||||
* @param int $error_level
|
||||
* The level of the error raised.
|
||||
* @param string $message
|
||||
|
@ -127,7 +129,6 @@ class ModuleTest extends ViewsKernelTestBase {
|
|||
* An array that points to the active symbol table at the point the error
|
||||
* occurred.
|
||||
*
|
||||
* Because this is registered in set_error_handler(), it has to be public.
|
||||
* @see set_error_handler()
|
||||
*/
|
||||
public function customErrorHandler($error_level, $message, $filename, $line, $context) {
|
||||
|
@ -229,7 +230,7 @@ class ModuleTest extends ViewsKernelTestBase {
|
|||
$plugins = Views::fetchPluginNames('style');
|
||||
$definitions = $this->container->get('plugin.manager.views.style')->getDefinitions();
|
||||
$expected = array();
|
||||
foreach ($definitions as $id =>$definition) {
|
||||
foreach ($definitions as $id => $definition) {
|
||||
$expected[$id] = $definition['title'];
|
||||
}
|
||||
asort($expected);
|
||||
|
|
|
@ -31,7 +31,7 @@ class RowRenderCacheTest extends ViewsKernelTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $testViews = array('test_row_render_cache');
|
||||
public static $testViews = array('test_row_render_cache', 'test_row_render_cache_none');
|
||||
|
||||
/**
|
||||
* An editor user account.
|
||||
|
@ -103,6 +103,34 @@ class RowRenderCacheTest extends ViewsKernelTestBase {
|
|||
$this->doTestRenderedOutput($this->editorUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that rows are not cached when the none cache plugin is used.
|
||||
*/
|
||||
public function testNoCaching() {
|
||||
$this->setCurrentUser($this->regularUser);
|
||||
$view = Views::getView('test_row_render_cache_none');
|
||||
$view->setDisplay();
|
||||
$view->preview();
|
||||
|
||||
/** @var \Drupal\Core\Render\RenderCacheInterface $render_cache */
|
||||
$render_cache = $this->container->get('render_cache');
|
||||
|
||||
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache_plugin */
|
||||
$cache_plugin = $view->display_handler->getPlugin('cache');
|
||||
|
||||
foreach ($view->result as $row) {
|
||||
$keys = $cache_plugin->getRowCacheKeys($row);
|
||||
$cache = [
|
||||
'#cache' => [
|
||||
'keys' => $keys,
|
||||
'contexts' => ['languages:language_interface', 'theme', 'user.permissions'],
|
||||
],
|
||||
];
|
||||
$element = $render_cache->get($cache);
|
||||
$this->assertFalse($element);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the rendered output matches expectations.
|
||||
*
|
||||
|
@ -161,7 +189,13 @@ class RowRenderCacheTest extends ViewsKernelTestBase {
|
|||
if ($check_cache) {
|
||||
$keys = $cache_plugin->getRowCacheKeys($view->result[$index]);
|
||||
$user_context = !$account->hasPermission('edit any test content') ? 'user' : 'user.permissions';
|
||||
$element = $render_cache->get(['#cache' => ['keys' => $keys, 'contexts' => ['languages:language_interface', 'theme', $user_context]]]);
|
||||
$cache = [
|
||||
'#cache' => [
|
||||
'keys' => $keys,
|
||||
'contexts' => ['languages:language_interface', 'theme', $user_context],
|
||||
],
|
||||
];
|
||||
$element = $render_cache->get($cache);
|
||||
$this->assertTrue($element);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ class RenderCacheIntegrationTest extends ViewsKernelTestBase {
|
|||
|
||||
// Empty result (no entities yet).
|
||||
$this->pass('Test without entities');
|
||||
$base_tags = ['config:views.view.entity_test_fields', 'entity_test_list'];
|
||||
$base_tags = ['config:views.view.entity_test_fields', 'entity_test_list'];
|
||||
$this->assertViewsCacheTags($view, $base_tags, $do_assert_views_caches, $base_tags);
|
||||
$this->assertViewsCacheTagsFromStaticRenderArray($view, $base_tags, $do_assert_views_caches);
|
||||
|
||||
|
|
56
core/modules/views/tests/src/Kernel/TestViewsTest.php
Normal file
56
core/modules/views/tests/src/Kernel/TestViewsTest.php
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\views\Kernel;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\config_test\TestInstallStorage;
|
||||
use Drupal\Core\Config\InstallStorage;
|
||||
use Drupal\Core\Config\TypedConfigManager;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests that test views provided by all modules match schema.
|
||||
*
|
||||
* @group config
|
||||
*/
|
||||
class TestViewsTest extends KernelTestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('views_test_data');
|
||||
|
||||
/**
|
||||
* Tests default configuration data type.
|
||||
*/
|
||||
public function testDefaultConfig() {
|
||||
// Create a typed config manager with access to configuration schema in
|
||||
// every module, profile and theme.
|
||||
$typed_config = new TypedConfigManager(
|
||||
\Drupal::service('config.storage'),
|
||||
new TestInstallStorage(InstallStorage::CONFIG_SCHEMA_DIRECTORY),
|
||||
\Drupal::service('cache.discovery'),
|
||||
\Drupal::service('module_handler')
|
||||
);
|
||||
|
||||
// Create a configuration storage with access to default configuration in
|
||||
// every module, profile and theme.
|
||||
$default_config_storage = new TestInstallStorage('test_views');
|
||||
|
||||
foreach ($default_config_storage->listAll() as $config_name) {
|
||||
// Skip files provided by the config_schema_test module since that module
|
||||
// is explicitly for testing schema.
|
||||
if (strpos($config_name, 'config_schema_test') === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data = $default_config_storage->read($config_name);
|
||||
$this->assertConfigSchema($typed_config, $config_name, $data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -422,7 +422,7 @@ class ViewExecutableTest extends ViewsKernelTestBase {
|
|||
$count = 0;
|
||||
foreach ($view->displayHandlers as $id => $display) {
|
||||
$match = function($value) use ($display) {
|
||||
return strpos($value, $display->display['display_title']) !== false;
|
||||
return strpos($value, $display->display['display_title']) !== FALSE;
|
||||
};
|
||||
$this->assertTrue(array_filter($validate[$id], $match), format_string('Error message found for @id display', array('@id' => $id)));
|
||||
$count++;
|
||||
|
|
|
@ -71,4 +71,3 @@ class WizardPluginBaseKernelTest extends ViewsKernelTestBase {
|
|||
$this->assertEqual($view->get('langcode'), 'it');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -360,4 +360,3 @@ class ViewAjaxControllerTest extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ class EntityTest extends UnitTestCase {
|
|||
$options['bundles'] = array('test_bundle' => 1);
|
||||
$argumentValidator->init($this->executable, $this->display, $options);
|
||||
|
||||
$this->assertEquals(['config'=>['test_bundle']], $argumentValidator->calculateDependencies());
|
||||
$this->assertEquals(['config' => ['test_bundle']], $argumentValidator->calculateDependencies());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -395,46 +395,46 @@ class FieldPluginBaseTest extends UnitTestCase {
|
|||
|
||||
// Simple path with default options.
|
||||
$url = Url::fromRoute('test_route');
|
||||
$data[]= [$url, [], clone $url, '/test-path', clone $url, '<a href="/test-path">value</a>'];
|
||||
$data[] = [$url, [], clone $url, '/test-path', clone $url, '<a href="/test-path">value</a>'];
|
||||
|
||||
// Simple url with parameters.
|
||||
$url_parameters = Url::fromRoute('test_route', ['key' => 'value']);
|
||||
$data[]= [$url_parameters, [], clone $url_parameters, '/test-path/value', clone $url_parameters, '<a href="/test-path/value">value</a>'];
|
||||
$data[] = [$url_parameters, [], clone $url_parameters, '/test-path/value', clone $url_parameters, '<a href="/test-path/value">value</a>'];
|
||||
|
||||
// Add a fragment.
|
||||
$url = Url::fromRoute('test_route');
|
||||
$url_with_fragment = Url::fromRoute('test_route');
|
||||
$options = ['fragment' => 'test'] + $this->defaultUrlOptions;
|
||||
$url_with_fragment->setOptions($options);
|
||||
$data[]= [$url, ['fragment' => 'test'], $url_with_fragment, '/test-path#test', clone $url_with_fragment, '<a href="/test-path#test">value</a>'];
|
||||
$data[] = [$url, ['fragment' => 'test'], $url_with_fragment, '/test-path#test', clone $url_with_fragment, '<a href="/test-path#test">value</a>'];
|
||||
|
||||
// Rel attributes.
|
||||
$url = Url::fromRoute('test_route');
|
||||
$url_with_rel = Url::fromRoute('test_route');
|
||||
$options = ['attributes' => ['rel' => 'up']] + $this->defaultUrlOptions;
|
||||
$url_with_rel->setOptions($options);
|
||||
$data[]= [$url, ['rel' => 'up'], clone $url, '/test-path', $url_with_rel, '<a href="/test-path" rel="up">value</a>'];
|
||||
$data[] = [$url, ['rel' => 'up'], clone $url, '/test-path', $url_with_rel, '<a href="/test-path" rel="up">value</a>'];
|
||||
|
||||
// Target attributes.
|
||||
$url = Url::fromRoute('test_route');
|
||||
$url_with_target = Url::fromRoute('test_route');
|
||||
$options = ['attributes' => ['target' => '_blank']] + $this->defaultUrlOptions;
|
||||
$url_with_target->setOptions($options);
|
||||
$data[]= [$url, ['target' => '_blank'], $url_with_target, '/test-path', clone $url_with_target, '<a href="/test-path" target="_blank">value</a>'];
|
||||
$data[] = [$url, ['target' => '_blank'], $url_with_target, '/test-path', clone $url_with_target, '<a href="/test-path" target="_blank">value</a>'];
|
||||
|
||||
// Link attributes.
|
||||
$url = Url::fromRoute('test_route');
|
||||
$url_with_link_attributes = Url::fromRoute('test_route');
|
||||
$options = ['attributes' => ['foo' => 'bar']] + $this->defaultUrlOptions;
|
||||
$url_with_link_attributes->setOptions($options);
|
||||
$data[]= [$url, ['link_attributes' => ['foo' => 'bar']], clone $url, '/test-path', $url_with_link_attributes, '<a href="/test-path" foo="bar">value</a>'];
|
||||
$data[] = [$url, ['link_attributes' => ['foo' => 'bar']], clone $url, '/test-path', $url_with_link_attributes, '<a href="/test-path" foo="bar">value</a>'];
|
||||
|
||||
// Manual specified query.
|
||||
$url = Url::fromRoute('test_route');
|
||||
$url_with_query = Url::fromRoute('test_route');
|
||||
$options = ['query' => ['foo' => 'bar']] + $this->defaultUrlOptions;
|
||||
$url_with_query->setOptions($options);
|
||||
$data[]= [$url, ['query' => ['foo' => 'bar']], clone $url_with_query, '/test-path?foo=bar', $url_with_query, '<a href="/test-path?foo=bar">value</a>'];
|
||||
$data[] = [$url, ['query' => ['foo' => 'bar']], clone $url_with_query, '/test-path?foo=bar', $url_with_query, '<a href="/test-path?foo=bar">value</a>'];
|
||||
|
||||
// Query specified as part of the path.
|
||||
$url = Url::fromRoute('test_route')->setOption('query', ['foo' => 'bar']);
|
||||
|
@ -510,7 +510,7 @@ class FieldPluginBaseTest extends UnitTestCase {
|
|||
$field->field_alias = 'key';
|
||||
$row = new ResultRow(['key' => 'value']);
|
||||
|
||||
$build =[
|
||||
$build = [
|
||||
'#type' => 'inline_template',
|
||||
'#template' => 'test-path/' . explode('/', $path)[1],
|
||||
'#context' => ['foo' => 123],
|
||||
|
|
|
@ -161,7 +161,7 @@ class ViewsDataTest extends UnitTestCase {
|
|||
$this->assertCount(6, $base_tables, 'The correct amount of base tables were returned.');
|
||||
$base_tables_keys = array_keys($base_tables);
|
||||
for ($i = 1; $i < count($base_tables); ++$i) {
|
||||
$prev = $base_tables[$base_tables_keys[$i - 1]];
|
||||
$prev = $base_tables[$base_tables_keys[$i - 1]];
|
||||
$current = $base_tables[$base_tables_keys[$i]];
|
||||
$this->assertTrue($prev['weight'] <= $current['weight'] && $prev['title'] <= $prev['title'], 'The tables are sorted as expected.');
|
||||
}
|
||||
|
|
Reference in a new issue