diff --git a/core/modules/aggregator/aggregator.install b/core/modules/aggregator/aggregator.install index a763639..aab9ea5 100644 --- a/core/modules/aggregator/aggregator.install +++ b/core/modules/aggregator/aggregator.install @@ -37,3 +37,16 @@ function aggregator_update_8001() { /** * @} End of "addtogroup updates-8.0.0-rc". */ + +/** + * Promote 'guid' field to uuid entity key. + */ +function aggregator_update_8002() { + $manager = \Drupal::entityDefinitionUpdateManager(); + $entity_type = $manager->getEntityType('aggregator_item'); + $entity_keys = $entity_type->getKeys(); + $entity_keys['uuid'] = 'guid'; + $entity_type->set('entity_keys', $entity_keys); + $manager->updateEntityType($entity_type); + $manager->updateFieldStorageDefinition($manager->getFieldStorageDefinition('guid', 'aggregator_item')); +} diff --git a/core/modules/aggregator/src/Tests/AggregatorTitleTest.php b/core/modules/aggregator/src/Tests/AggregatorTitleTest.php index d599d9a..cea30fd 100644 --- a/core/modules/aggregator/src/Tests/AggregatorTitleTest.php +++ b/core/modules/aggregator/src/Tests/AggregatorTitleTest.php @@ -54,6 +54,7 @@ public function testStringFormatter() { $aggregator_feed = Feed::create([ 'title' => 'testing title', 'url' => 'http://www.example.com', + 'guid' => $this->randomMachineName(), ]); $aggregator_feed->save(); @@ -62,6 +63,7 @@ public function testStringFormatter() { 'title' => 'test title', 'fid' => $aggregator_feed->id(), 'link' => 'http://www.example.com', + 'guid' => $this->randomMachineName(), ]); $aggregator_item->save(); diff --git a/core/modules/aggregator/src/Tests/Views/AggregatorItemViewsFieldAccessTest.php b/core/modules/aggregator/src/Tests/Views/AggregatorItemViewsFieldAccessTest.php index b1c23c5..b020131 100644 --- a/core/modules/aggregator/src/Tests/Views/AggregatorItemViewsFieldAccessTest.php +++ b/core/modules/aggregator/src/Tests/Views/AggregatorItemViewsFieldAccessTest.php @@ -40,12 +40,14 @@ public function testAggregatorItemFields() { $feed = Feed::create([ 'title' => 'Drupal org', 'url' => 'https://www.drupal.org/rss.xml', + 'guid' => $this->randomMachineName(), ]); $feed->save(); $item = Item::create([ 'title' => 'Test title', 'fid' => $feed->id(), 'description' => 'Test description', + 'guid' => $this->randomMachineName(), ]); $item->save(); diff --git a/core/modules/aggregator/src/Tests/Views/IntegrationTest.php b/core/modules/aggregator/src/Tests/Views/IntegrationTest.php index 51665b2..89b6a2d 100644 --- a/core/modules/aggregator/src/Tests/Views/IntegrationTest.php +++ b/core/modules/aggregator/src/Tests/Views/IntegrationTest.php @@ -91,7 +91,7 @@ public function testAggregatorItemView() { // Add a image to ensure that the sanitizing can be tested below. $values['author'] = $this->randomMachineName() . '"'; $values['link'] = 'https://www.drupal.org/node/' . mt_rand(1000, 10000); - $values['guid'] = $i; + $values['guid'] = 'guid-' . $i; $aggregator_item = $this->itemStorage->create($values); $aggregator_item->save(); diff --git a/core/modules/aggregator/tests/modules/aggregator_test_views/test_views/views.view.test_aggregator_items.yml b/core/modules/aggregator/tests/modules/aggregator_test_views/test_views/views.view.test_aggregator_items.yml index 653bc49..6776ef2 100644 --- a/core/modules/aggregator/tests/modules/aggregator_test_views/test_views/views.view.test_aggregator_items.yml +++ b/core/modules/aggregator/tests/modules/aggregator_test_views/test_views/views.view.test_aggregator_items.yml @@ -192,7 +192,7 @@ display: admin_label: '' empty: false tokenize: true - target: 1 + target: guid-1 view_mode: default bypass_access: true plugin_id: entity