updated core to 8.6.3

This commit is contained in:
2018-11-21 12:49:46 +01:00
parent 8ca34853a3
commit c92c348eee
521 changed files with 12199 additions and 4578 deletions
@@ -1052,6 +1052,12 @@ class EntityField extends FieldPluginBase implements CacheableDependencyInterfac
*/
public function getValue(ResultRow $values, $field = NULL) {
$entity = $this->getEntity($values);
// Ensure the object is not NULL before attempting to translate it.
if ($entity === NULL) {
return NULL;
}
// Retrieve the translated object.
$translated_entity = $this->getEntityFieldRenderer()->getEntityTranslation($entity, $values);
@@ -106,7 +106,7 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
/**
* Keeps track of the last render index.
*
* @var int|NULL
* @var int|null
*/
protected $lastRenderIndex;
@@ -5,7 +5,7 @@ namespace Drupal\views\Plugin\views\field;
use Drupal\views\ResultRow;
/**
* Defines a field hander which renders multiple items per row.
* Defines a field handler which renders multiple items per row.
*/
interface MultiItemsFieldHandlerInterface extends FieldHandlerInterface {
@@ -103,7 +103,7 @@ abstract class WizardPluginBase extends PluginBase implements WizardInterface {
* By default, filters are not exposed and added to the first non-reserved
* filter group.
*
* @var array()
* @var array
*/
protected $filter_defaults = [
'id' => NULL,
@@ -32,7 +32,7 @@ abstract class ViewKernelTestBase extends KernelTestBase {
* {@inheritdoc}
*
* @param bool $import_test_views
* Should the views specififed on the test class be imported. If you need
* Should the views specified on the test class be imported. If you need
* to setup some additional stuff, like fields, you need to call false and
* then call createTestViews for your own.
*/
+2 -2
View File
@@ -114,7 +114,7 @@ class ViewExecutable {
/**
* Attachments to place before the view.
*
* @var array()
* @var array
*/
public $attachment_before = [];
@@ -1522,7 +1522,7 @@ class ViewExecutable {
// Let modules modify the view just prior to rendering it.
$module_handler->invokeAll('views_pre_render', [$this]);
// Let the themes play too, because pre render is a very themey thing.
// Let the themes play too, because prerender is a very themey thing.
foreach ($themes as $theme_name) {
$function = $theme_name . '_views_pre_render';
if (function_exists($function)) {
@@ -7,11 +7,11 @@ use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Url;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\views\Views;
use Drupal\comment\Entity\Comment;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\taxonomy\Entity\Term;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
/**
* Tests the default views provided by views.
@@ -1,14 +1,14 @@
<?php
namespace Drupal\views\Tests;
namespace Drupal\Tests\views\Functional;
use Drupal\Component\Render\MarkupInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Tests\Views\FieldTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\language\Entity\ContentLanguageSettings;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\field\Functional\Views\FieldTestBase;
use Drupal\views\Views;
/**
@@ -263,7 +263,7 @@ class FieldApiDataTest extends FieldTestBase {
}
/**
* Tests filtering entries with different translatabilty.
* Tests filtering entries with different translatability.
*/
public function testEntityFieldFilter() {
$map = [
@@ -339,7 +339,7 @@ class FieldWebTest extends ViewTestBase {
$this->assertSubString($output, UrlHelper::encodePath('Drupal Has A Great Community'));
unset($id_field->options['alter']['path_case']);
// Tests the linkclass setting and see whether it actually exists in the
// Tests the link_class setting and see whether it actually exists in the
// output.
$id_field->options['alter']['link_class'] = $class = $this->randomMachineName();
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($id_field, $row) {
@@ -5,7 +5,7 @@ namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Views;
@@ -213,7 +213,7 @@ class DisplayEntityReferenceTest extends ViewTestBase {
$this->drupalPostForm('admin/structure/views/nojs/display/test_display_entity_reference/entity_reference_1/style_options', ['style_options[search_fields][uid]' => 'uid'], t('Apply'));
$this->drupalPostForm(NULL, [], t('Save'));
// Test that the search still works with the ralated field.
// Test that the search still works with the related field.
$view = Views::getView('test_display_entity_reference');
$view->setDisplay('entity_reference_1');
@@ -1,7 +1,8 @@
<?php
namespace Drupal\views\Tests\Plugin;
namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Views;
/**
@@ -10,7 +11,7 @@ use Drupal\views\Views;
* @group views
* @see \Drupal\views\Plugin\views\display\Feed
*/
class DisplayFeedTest extends PluginTestBase {
class DisplayFeedTest extends ViewTestBase {
/**
* Views used by this test.
@@ -58,9 +59,8 @@ class DisplayFeedTest extends PluginTestBase {
$this->config('system.site')->set('name', $site_name)->save();
$this->drupalGet('test-feed-display.xml');
$result = $this->xpath('//title');
$this->assertEqual($result[0], $site_name, 'The site title is used for the feed title.');
$this->assertEqual($result[1], $node_title, 'Node title with HTML entities displays correctly.');
$this->assertEquals($site_name, $this->getSession()->getDriver()->getText('//title'));
$this->assertEquals($node_title, $this->getSession()->getDriver()->getText('//item/title'));
// Verify HTML is properly escaped in the description field.
$this->assertRaw('&lt;p&gt;A paragraph&lt;/p&gt;');
@@ -70,8 +70,7 @@ class DisplayFeedTest extends PluginTestBase {
$view->save();
$this->drupalGet('test-feed-display.xml');
$result = $this->xpath('//title');
$this->assertEqual($result[0], 'test_display_feed', 'The display title is used for the feed title.');
$this->assertEquals('test_display_feed', $this->getSession()->getDriver()->getText('//title'));
// Add a block display and attach the feed.
$view->getExecutable()->newDisplay('block', NULL, 'test');
@@ -82,14 +81,14 @@ class DisplayFeedTest extends PluginTestBase {
$this->drupalPlaceBlock('views_block:test_display_feed-test');
$this->drupalGet('<front>');
$feed_icon = $this->cssSelect('div.view-id-test_display_feed a.feed-icon');
$this->assertTrue(strpos($feed_icon[0]['href'], 'test-feed-display.xml'), 'The feed icon was found.');
$this->assertTrue(strpos($feed_icon[0]->getAttribute('href'), 'test-feed-display.xml'), 'The feed icon was found.');
// Test feed display attached to page display with arguments.
$this->drupalGet('test-feed-icon/' . $node->id());
$page_url = $this->getUrl();
$icon_href = $this->cssSelect('a.feed-icon[href *= "test-feed-icon"]')[0]['href'];
$icon_href = $this->cssSelect('a.feed-icon[href *= "test-feed-icon"]')[0]->getAttribute('href');
$this->assertEqual($icon_href, $page_url . '/feed', 'The feed icon was found.');
$link_href = $this->cssSelect('link[type = "application/rss+xml"][href *= "test-feed-icon"]')[0]['href'];
$link_href = $this->cssSelect('link[type = "application/rss+xml"][href *= "test-feed-icon"]')[0]->getAttribute('href');
$this->assertEqual($link_href, $page_url . '/feed', 'The RSS link was found.');
$feed_link = simplexml_load_string($this->drupalGet($icon_href))->channel->link;
$this->assertEqual($feed_link, $page_url, 'The channel link was found.');
@@ -114,8 +113,7 @@ class DisplayFeedTest extends PluginTestBase {
]);
$this->drupalGet('test-feed-display-fields.xml');
$result = $this->xpath('//title/a');
$this->assertEqual($result[0], $node_title, 'Node title with HTML entities displays correctly.');
$this->assertEquals($node_title, $this->getSession()->getDriver()->getText('//title/a'));
// Verify HTML is properly escaped in the description field.
$this->assertRaw('&lt;p&gt;A paragraph&lt;/p&gt;');
}
@@ -136,8 +134,8 @@ class DisplayFeedTest extends PluginTestBase {
// Check that the rss header is output on the page display.
$this->drupalGet('/test-attached-disabled');
$feed_header = $this->xpath('//link[@rel="alternate"]');
$this->assertEqual($feed_header[0]['type'], 'application/rss+xml', 'The feed link has the type application/rss+xml.');
$this->assertTrue(strpos($feed_header[0]['href'], 'test-attached-disabled.xml'), 'Page display contains the correct feed URL.');
$this->assertEqual($feed_header[0]->getAttribute('type'), 'application/rss+xml', 'The feed link has the type application/rss+xml.');
$this->assertTrue(strpos($feed_header[0]->getAttribute('href'), 'test-attached-disabled.xml'), 'Page display contains the correct feed URL.');
// Disable the feed display.
$view->displayHandlers->get('feed_1')->setOption('enabled', FALSE);
@@ -3,9 +3,9 @@
namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Views;
@@ -1,6 +1,8 @@
<?php
namespace Drupal\views\Tests\Plugin;
namespace Drupal\Tests\views\Functional\Plugin;
use Drupal\Tests\views\Functional\ViewTestBase;
/**
* Tests the OPML feed style plugin.
@@ -8,7 +10,7 @@ namespace Drupal\views\Tests\Plugin;
* @group views
* @see \Drupal\views\Plugin\views\style\Opml
*/
class StyleOpmlTest extends PluginTestBase {
class StyleOpmlTest extends ViewTestBase {
/**
* Views used by this test.
@@ -52,10 +54,10 @@ class StyleOpmlTest extends PluginTestBase {
$feed->save();
$this->drupalGet('test-feed-opml-style');
$outline = $this->xpath('//outline[1]');
$this->assertEqual($outline[0]['type'], 'rss', 'The correct type attribute is used for rss OPML.');
$this->assertEqual($outline[0]['text'], $feed->label(), 'The correct text attribute is used for rss OPML.');
$this->assertEqual($outline[0]['xmlurl'], $feed->getUrl(), 'The correct xmlUrl attribute is used for rss OPML.');
$outline = $this->getSession()->getDriver()->find('//outline[1]')[0];
$this->assertEquals('rss', $outline->getAttribute('type'));
$this->assertEquals($feed->label(), $outline->getAttribute('text'));
$this->assertEquals($feed->getUrl(), $outline->getAttribute('xmlUrl'));
$view = $this->container->get('entity.manager')
->getStorage('view')
@@ -66,12 +68,12 @@ class StyleOpmlTest extends PluginTestBase {
$view->save();
$this->drupalGet('test-feed-opml-style');
$outline = $this->xpath('//outline[1]');
$this->assertEqual($outline[0]['type'], 'link', 'The correct type attribute is used for link OPML.');
$this->assertEqual($outline[0]['text'], $feed->label(), 'The correct text attribute is used for link OPML.');
$this->assertEqual($outline[0]['url'], $feed->getUrl(), 'The correct URL attribute is used for link OPML.');
$outline = $this->getSession()->getDriver()->find('//outline[1]')[0];
$this->assertEquals('link', $outline->getAttribute('type'));
$this->assertEquals($feed->label(), $outline->getAttribute('text'));
$this->assertEquals($feed->getUrl(), $outline->getAttribute('url'));
// xmlUrl should not be present when type is link.
$this->assertNull($outline[0]['xmlUrl'], 'The xmlUrl attribute is not used for link OPML.');
$this->assertNull($outline->getAttribute('xmlUrl'));
}
}
@@ -4,8 +4,8 @@ namespace Drupal\Tests\views\Functional\Wizard;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
/**
* Tests the ability of the views wizard to create views filtered by taxonomy.
@@ -37,9 +37,9 @@ class ModuleTest extends ViewsKernelTestBase {
protected $lastErrorMessage;
/**
* Tests the views_get_handler method.
* Tests the ViewsHandlerManager::getHandler() method.
*
* @see views_get_handler()
* @see \Drupal\views\Plugin\ViewsHandlerManager::getHandler()
*/
public function testViewsGetHandler() {
$types = ['field', 'area', 'filter'];
@@ -136,7 +136,7 @@ class ViewExecutableTest extends ViewsKernelTestBase {
// Test the initStyle() method.
$view->initStyle();
$this->assertTrue($view->style_plugin instanceof DefaultStyle, 'Make sure a reference to the style plugin is set.');
// Test the plugin has been inited and view have references to the view and
// Test the plugin has been invited and view have references to the view and
// display handler.
$this->assertEqual(spl_object_hash($view->style_plugin->view), $view_hash);
$this->assertEqual(spl_object_hash($view->style_plugin->displayHandler), $display_hash);
+7 -3
View File
@@ -375,9 +375,13 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora
else {
// https://www.drupal.org/node/2451657#comment-11462881
\Drupal::logger('views')->error(
t('A non-existent config entity name returned by FieldStorageConfigInterface::getBundles(): field name: %field, bundle: %bundle',
['%field' => $field_name, '%bundle' => $bundle]
));
'A non-existent config entity name returned by FieldStorageConfigInterface::getBundles(): entity type: %entity_type, bundle: %bundle, field name: %field',
[
'%entity_type' => $entity_type->id(),
'%bundle' => $bundle,
'%field' => $field_name,
]
);
}
}