diff --git a/core/modules/hal/tests/src/Functional/EntityResource/Shortcut/ShortcutHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/EntityResource/Shortcut/ShortcutHalJsonAnonTest.php index ae49987..b5eab96 100644 --- a/core/modules/hal/tests/src/Functional/EntityResource/Shortcut/ShortcutHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/EntityResource/Shortcut/ShortcutHalJsonAnonTest.php @@ -34,19 +34,19 @@ class ShortcutHalJsonAnonTest extends ShortcutResourceTestBase { * {@inheritdoc} */ protected function getExpectedNormalizedEntity() { - $default_normalization = parent::getExpectedNormalizedEntity(); + $default_normalization = parent::getExpectedNormalizedEntity(); - $normalization = $this->applyHalFieldNormalization($default_normalization); + $normalization = $this->applyHalFieldNormalization($default_normalization); - return $normalization + [ - '_links' => [ - 'self' => [ - 'href' => $this->baseUrl . '/admin/config/user-interface/shortcut/link/1?_format=hal_json', + return $normalization + [ + '_links' => [ + 'self' => [ + 'href' => $this->baseUrl . '/admin/config/user-interface/shortcut/link/1?_format=hal_json', + ], + 'type' => [ + 'href' => $this->baseUrl . '/rest/type/shortcut/default', + ], ], - 'type' => [ - 'href' => $this->baseUrl . '/rest/type/shortcut/default', - ], - ], ]; } @@ -54,12 +54,12 @@ protected function getExpectedNormalizedEntity() { * {@inheritdoc} */ protected function getNormalizedPostEntity() { - return parent::getNormalizedPostEntity() + [ - '_links' => [ - 'type' => [ - 'href' => $this->baseUrl . '/rest/type/shortcut/default', + return parent::getNormalizedPostEntity() + [ + '_links' => [ + 'type' => [ + 'href' => $this->baseUrl . '/rest/type/shortcut/default', + ], ], - ], ]; } diff --git a/core/modules/rest/tests/src/Functional/EntityResource/Shortcut/ShortcutResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/Shortcut/ShortcutResourceTestBase.php index 51064f6..2bd5f25 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/Shortcut/ShortcutResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/Shortcut/ShortcutResourceTestBase.php @@ -37,86 +37,86 @@ * {@inheritdoc} */ protected function setUpAuthorization($method) { - switch ($method) { - case 'GET': - $this->grantPermissionsToTestedRole(['access shortcuts', 'customize shortcut links']); - break; - case 'POST': - case 'PATCH': - case 'DELETE': - $this->grantPermissionsToTestedRole(['administer shortcuts']); - break; - } + switch ($method) { + case 'GET': + $this->grantPermissionsToTestedRole(['access shortcuts', 'customize shortcut links']); + break; + case 'POST': + case 'PATCH': + case 'DELETE': + $this->grantPermissionsToTestedRole(['administer shortcuts']); + break; + } } /** * {@inheritdoc} */ protected function createEntity() { - // Create shortcut. - $shortcut = Shortcut::create(array( - 'shortcut_set' => 'default', - 'title' => t('Comments'), - 'weight' => -20, - 'link' => array( - 'uri' => 'internal:/admin/content/comment', - ), - )); - $shortcut->save(); + // Create shortcut. + $shortcut = Shortcut::create(array( + 'shortcut_set' => 'default', + 'title' => t('Comments'), + 'weight' => -20, + 'link' => array( + 'uri' => 'internal:/admin/content/comment', + ), + )); + $shortcut->save(); - return $shortcut; + return $shortcut; } /** * {@inheritdoc} */ protected function getExpectedNormalizedEntity() { - return [ - 'uuid' => [ - [ - 'value' => $this->entity->uuid(), - ], - ], - 'id' => [ - [ - 'value' => (int) $this->entity->id(), - ], - ], - 'title' => [ - [ - 'value' => 'Comments', - ], - ], - 'shortcut_set' => [ - [ - 'target_id' => 'default', - 'target_type' => 'shortcut_set', - 'target_uuid' => ShortcutSet::load('default')->uuid(), - ], - ], - 'link' => [ - [ - 'uri' => 'internal:/admin/content/comment', - 'title' => NULL, - 'options' => [], - ], - ], - 'weight' => [ - [ - 'value' => -20, - ], - ], - 'langcode' => [ - [ - 'value' => 'en', - ], - ], - 'default_langcode' => [ - [ - 'value' => TRUE, + return [ + 'uuid' => [ + [ + 'value' => $this->entity->uuid(), + ], + ], + 'id' => [ + [ + 'value' => (int) $this->entity->id(), + ], ], - ], - ]; + 'title' => [ + [ + 'value' => 'Comments', + ], + ], + 'shortcut_set' => [ + [ + 'target_id' => 'default', + 'target_type' => 'shortcut_set', + 'target_uuid' => ShortcutSet::load('default')->uuid(), + ], + ], + 'link' => [ + [ + 'uri' => 'internal:/admin/content/comment', + 'title' => NULL, + 'options' => [], + ], + ], + 'weight' => [ + [ + 'value' => -20, + ], + ], + 'langcode' => [ + [ + 'value' => 'en', + ], + ], + 'default_langcode' => [ + [ + 'value' => TRUE, + ], + ], + ]; } /** @@ -124,16 +124,16 @@ protected function getExpectedNormalizedEntity() { */ protected function getNormalizedPostEntity() { return [ - 'title' => [ - [ - 'value' => 'Comments', - ], - ], - 'link' => [ - [ - 'uri' => 'internal:/', # 'internal:/', 'route:', 'route:', ...? - ], - ], + 'title' => [ + [ + 'value' => 'Comments', + ], + ], + 'link' => [ + [ + 'uri' => 'internal:/', # 'internal:/', 'route:', 'route:', ...? + ], + ], 'shortcut_set' => 'default', ]; }