core/modules/rest/rest.post_update.php | 4 +-- ...eTest.php => ResourceGranularityUpdateTest.php} | 30 +++++---------------- .../Update/RestConfigurationEntitiesUpdateTest.php | 2 ++ ...rest-rest_post_update_resource_granularity.php} | Bin 5368 -> 5322 bytes 4 files changed, 10 insertions(+), 26 deletions(-) diff --git a/core/modules/rest/rest.post_update.php b/core/modules/rest/rest.post_update.php index 68ec807..445c617 100644 --- a/core/modules/rest/rest.post_update.php +++ b/core/modules/rest/rest.post_update.php @@ -32,11 +32,11 @@ function rest_post_update_create_rest_resource_config_entities() { } /** - * Simplify method-granularity REST resources to resource-granularity. + * Simplify method-granularity REST resource config to resource-granularity. * * @see https://www.drupal.org/node/2721595 */ -function rest_post_update_simplify_method_granularity_to_resource_granularity_where_possible() { +function rest_post_update_resource_granularity() { /** @var \Drupal\rest\RestResourceConfigInterface[] $resource_config_entities */ $resource_config_entities = RestResourceConfig::loadMultiple(); diff --git a/core/modules/rest/src/Tests/Update/ResourceGranularityRestResourcesConfigEntitiesUpdateTest.php b/core/modules/rest/src/Tests/Update/ResourceGranularityUpdateTest.php similarity index 74% rename from core/modules/rest/src/Tests/Update/ResourceGranularityRestResourcesConfigEntitiesUpdateTest.php rename to core/modules/rest/src/Tests/Update/ResourceGranularityUpdateTest.php index 0f20ca8..c8cf89a 100644 --- a/core/modules/rest/src/Tests/Update/ResourceGranularityRestResourcesConfigEntitiesUpdateTest.php +++ b/core/modules/rest/src/Tests/Update/ResourceGranularityUpdateTest.php @@ -5,13 +5,14 @@ use Drupal\system\Tests\Update\UpdatePathTestBase; /** - * Tests rest_resource_config entities are simplified when possible. + * Tests method-granularity REST config is simplified to resource-granularity. * * @see https://www.drupal.org/node/2721595 + * @see rest_post_update_resource_granularity() * * @group rest */ -class ResourceGranularityRestResourcesConfigEntitiesUpdateTest extends UpdatePathTestBase { +class ResourceGranularityUpdateTest extends UpdatePathTestBase { /** * {@inheritdoc} @@ -24,14 +25,14 @@ class ResourceGranularityRestResourcesConfigEntitiesUpdateTest extends UpdatePat public function setDatabaseDumpFiles() { $this->databaseDumpFiles = [ __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz', - __DIR__ . '/../../../../rest/tests/fixtures/update/drupal-8.rest-rest_update_8202.php', + __DIR__ . '/../../../../rest/tests/fixtures/update/drupal-8.rest-rest_post_update_resource_granularity.php', ]; } /** - * Tests rest_post_update_simplify_method_granularity_to_resource_granularity_where_possible(). + * Tests rest_post_update_simplify_resource_granularity(). */ - public function testMethodGranularityResourcesConvertedToResourceGranularityResources() { + public function testMethodGranularityConvertedToResourceGranularity() { /** @var \Drupal\Core\Entity\EntityStorageInterface $resource_config_storage */ $resource_config_storage = $this->container->get('entity_type.manager')->getStorage('rest_resource_config'); @@ -65,25 +66,6 @@ public function testMethodGranularityResourcesConvertedToResourceGranularityReso // 'entity:user' should be unchanged. $this->assertIdentical('method', $resource_config_entities['entity.user']->get('granularity')); $this->assertIdentical($user_resource_configuration, $resource_config_entities['entity.user']->get('configuration')); - - - - // WTF: loadMultiple() vs load() are returning different results! - - // prints 'method' - debug($resource_config_storage->loadMultiple()['entity.node']->get('granularity')); - // prints 'resource' - debug($resource_config_storage->load('entity.node')->get('granularity')); - - - - // WTF++: even after resetting caches - $resource_config_storage->resetCache(); - - // prints 'method' - debug($resource_config_storage->loadMultiple()['entity.node']->get('granularity')); - // prints 'resource' - debug($resource_config_storage->load('entity.node')->get('granularity')); } } diff --git a/core/modules/rest/src/Tests/Update/RestConfigurationEntitiesUpdateTest.php b/core/modules/rest/src/Tests/Update/RestConfigurationEntitiesUpdateTest.php index 4a506f9..097da35 100644 --- a/core/modules/rest/src/Tests/Update/RestConfigurationEntitiesUpdateTest.php +++ b/core/modules/rest/src/Tests/Update/RestConfigurationEntitiesUpdateTest.php @@ -9,6 +9,8 @@ * Tests that rest.settings is converted to rest_resource_config entities. * * @see https://www.drupal.org/node/2308745 + * @see rest_update_8201() + * @see rest_post_update_create_rest_resource_config_entities() * * @group rest */ diff --git a/core/modules/rest/tests/fixtures/update/drupal-8.rest-rest_update_8202.php b/core/modules/rest/tests/fixtures/update/drupal-8.rest-rest_post_update_resource_granularity.php similarity index 98% rename from core/modules/rest/tests/fixtures/update/drupal-8.rest-rest_update_8202.php rename to core/modules/rest/tests/fixtures/update/drupal-8.rest-rest_post_update_resource_granularity.php index b286ee3..d657afc 100644 Binary files a/core/modules/rest/tests/fixtures/update/drupal-8.rest-rest_update_8202.php and b/core/modules/rest/tests/fixtures/update/drupal-8.rest-rest_post_update_resource_granularity.php differ