diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php index 0b9bba9..e5f3f08 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php @@ -2,6 +2,7 @@ namespace Drupal\Core\Field\Plugin\Field\FieldType; +use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Field\FieldItemBase; use Drupal\Core\Language\LanguageInterface; @@ -117,4 +118,12 @@ public function onChange($property_name, $notify = TRUE) { parent::onChange($property_name, $notify); } + /** + * {@inheritdoc} + */ + public static function generateSampleValue(FieldDefinitionInterface $field_definition) { + $values['value'] = LanguageInterface::LANGCODE_NOT_SPECIFIED; + return $values; + } + } diff --git a/core/modules/aggregator/tests/src/Kernel/Views/AggregatorFeedViewsFieldAccessTest.php b/core/modules/aggregator/tests/src/Kernel/Views/AggregatorFeedViewsFieldAccessTest.php index d0ca46e..9fa4496 100644 --- a/core/modules/aggregator/tests/src/Kernel/Views/AggregatorFeedViewsFieldAccessTest.php +++ b/core/modules/aggregator/tests/src/Kernel/Views/AggregatorFeedViewsFieldAccessTest.php @@ -34,6 +34,7 @@ public function testAggregatorFeedFields() { 'title' => 'Drupal org', 'url' => 'https://www.drupal.org/rss.xml', 'link' => 'https://www.drupal.org/rss.xml', + 'refresh' => 900, ]); $feed->save(); diff --git a/core/modules/comment/tests/src/Kernel/Views/CommentLinksTest.php b/core/modules/comment/tests/src/Kernel/Views/CommentLinksTest.php index ffb91b0..08a326d 100644 --- a/core/modules/comment/tests/src/Kernel/Views/CommentLinksTest.php +++ b/core/modules/comment/tests/src/Kernel/Views/CommentLinksTest.php @@ -19,6 +19,13 @@ class CommentLinksTest extends CommentViewsKernelTestBase { /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['entity_test']; + + /** * Views used by this test. * * @var array @@ -26,14 +33,26 @@ class CommentLinksTest extends CommentViewsKernelTestBase { public static $testViews = ['test_comment']; /** + * {@inheritdoc} + */ + protected function setUp($import_test_views = TRUE) { + parent::setUp($import_test_views); + + $this->installEntitySchema('entity_test'); + } + + /** * Test the comment approve link. */ public function testLinkApprove() { + $host = EntityTest::create(['name' => $this->randomString()]); + $host->save(); // Create an unapproved comment. $comment = $this->commentStorage->create([ 'uid' => $this->adminUser->id(), 'entity_type' => 'entity_test', + 'entity_id' => $host->id(), 'comment_type' => 'entity_test', 'status' => 0, ]); @@ -91,8 +110,7 @@ public function testLinkApprove() { * Test the comment reply link. */ public function testLinkReply() { - $this->enableModules(['field', 'entity_test']); - $this->installEntitySchema('entity_test'); + $this->enableModules(['field']); $this->installSchema('comment', ['comment_entity_statistics']); $this->installConfig(['field']); diff --git a/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php b/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php index dae2c48..92112e4 100644 --- a/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php +++ b/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php @@ -4,6 +4,7 @@ use Drupal\comment\Entity\Comment; use Drupal\Core\Session\AnonymousUserSession; +use Drupal\entity_test\Entity\EntityTest; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; use Drupal\user\Entity\Role; use Drupal\user\Entity\User; @@ -36,6 +37,7 @@ protected function setUp($import_test_views = TRUE) { $this->installEntitySchema('user'); $this->installEntitySchema('comment'); + $this->installEntitySchema('entity_test'); // Create the anonymous role. $this->installConfig(['user']); @@ -67,12 +69,16 @@ protected function setUp($import_test_views = TRUE) { ]); $this->adminUser->save(); + $host = EntityTest::create(['name' => $this->randomString()]); + $host->save(); + // Create some comments. $comment = Comment::create([ 'subject' => 'My comment title', 'uid' => $this->adminUser->id(), 'name' => $this->adminUser->label(), 'entity_type' => 'entity_test', + 'entity_id' => $host->id(), 'comment_type' => 'entity_test', 'status' => 1, ]); @@ -85,6 +91,7 @@ protected function setUp($import_test_views = TRUE) { 'mail' => 'test@example.com', 'homepage' => 'https://example.com', 'entity_type' => 'entity_test', + 'entity_id' => $host->id(), 'comment_type' => 'entity_test', 'created' => 123456, 'status' => 1, diff --git a/core/modules/comment/tests/src/Kernel/Views/CommentViewsFieldAccessTest.php b/core/modules/comment/tests/src/Kernel/Views/CommentViewsFieldAccessTest.php index f807c58..1ca5e43 100644 --- a/core/modules/comment/tests/src/Kernel/Views/CommentViewsFieldAccessTest.php +++ b/core/modules/comment/tests/src/Kernel/Views/CommentViewsFieldAccessTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\comment\Kernel\Views; use Drupal\comment\Entity\Comment; +use Drupal\entity_test\Entity\EntityTest; use Drupal\user\Entity\User; use Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase; @@ -25,6 +26,7 @@ protected function setUp($import_test_views = TRUE) { parent::setUp($import_test_views); $this->installEntitySchema('comment'); + $this->installEntitySchema('entity_test'); } /** @@ -36,10 +38,14 @@ public function testCommentFields() { ]); $user->save(); + $host = EntityTest::create(['name' => $this->randomString()]); + $host->save(); + $comment = Comment::create([ 'subject' => 'My comment title', 'uid' => $user->id(), 'entity_type' => 'entity_test', + 'entity_id' => $host->id(), 'comment_type' => 'entity_test', ]); $comment->save(); @@ -51,6 +57,7 @@ public function testCommentFields() { 'mail' => 'test@example.com', 'homepage' => 'https://example.com', 'entity_type' => 'entity_test', + 'entity_id' => $host->id(), 'comment_type' => 'entity_test', 'created' => 123456, 'status' => 1,