Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
720924f7
Commit
720924f7
authored
Jan 27, 2020
by
catch
Browse files
Issue
#2893804
by Wim Leers, Stefdewa, Berdir, catch: Remove rest.module BC layers
parent
474a6902
Changes
125
Hide whitespace changes
Inline
Side-by-side
core/modules/aggregator/tests/src/Functional/Rest/FeedResourceTestBase.php
View file @
720924f7
...
...
@@ -2,14 +2,11 @@
namespace
Drupal\Tests\aggregator\Functional\Rest
;
use
Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait
;
use
Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
;
use
Drupal\aggregator\Entity\Feed
;
abstract
class
FeedResourceTestBase
extends
EntityResourceTestBase
{
use
BcTimestampNormalizerUnixTestTrait
;
/**
* {@inheritdoc}
*/
...
...
@@ -105,10 +102,16 @@ protected function getExpectedNormalizedEntity() {
],
],
'checked'
=>
[
$this
->
formatExpectedTimestampItemValues
(
123456789
),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
(
123456789
)
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'queued'
=>
[
$this
->
formatExpectedTimestampItemValues
(
123456789
),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
(
123456789
)
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'link'
=>
[
[
...
...
@@ -136,7 +139,10 @@ protected function getExpectedNormalizedEntity() {
],
],
'modified'
=>
[
$this
->
formatExpectedTimestampItemValues
(
123456789
),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
(
123456789
)
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
];
}
...
...
@@ -173,10 +179,6 @@ protected function getNormalizedPostEntity() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
switch
(
$method
)
{
case
'GET'
:
return
"The 'access news feeds' permission is required."
;
...
...
core/modules/aggregator/tests/src/Functional/Rest/ItemResourceTestBase.php
View file @
720924f7
...
...
@@ -4,7 +4,6 @@
use
Drupal\aggregator\Entity\Feed
;
use
Drupal\aggregator\Entity\Item
;
use
Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait
;
use
Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
;
/**
...
...
@@ -12,8 +11,6 @@
*/
abstract
class
ItemResourceTestBase
extends
EntityResourceTestBase
{
use
BcTimestampNormalizerUnixTestTrait
;
/**
* {@inheritdoc}
*/
...
...
@@ -130,7 +127,10 @@ protected function getExpectedNormalizedEntity() {
'author'
=>
[],
'description'
=>
[],
'timestamp'
=>
[
$this
->
formatExpectedTimestampItemValues
(
123456789
),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
(
123456789
)
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'guid'
=>
[],
];
...
...
@@ -171,10 +171,6 @@ protected function getExpectedCacheContexts() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
switch
(
$method
)
{
case
'GET'
:
return
"The 'access news feeds' permission is required."
;
...
...
core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php
View file @
720924f7
...
...
@@ -130,10 +130,6 @@ protected function getExpectedCacheTags() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
switch
(
$method
)
{
case
'GET'
:
return
"The block visibility condition 'user_role' denied access."
;
...
...
core/modules/block_content/tests/src/Functional/Rest/BlockContentResourceTestBase.php
View file @
720924f7
...
...
@@ -5,7 +5,6 @@
use
Drupal\block_content
\
Entity\BlockContent
;
use
Drupal\block_content
\
Entity\BlockContentType
;
use
Drupal\Core\Cache\Cache
;
use
Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait
;
use
Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
;
/**
...
...
@@ -13,8 +12,6 @@
*/
abstract
class
BlockContentResourceTestBase
extends
EntityResourceTestBase
{
use
BcTimestampNormalizerUnixTestTrait
;
/**
* {@inheritdoc}
*/
...
...
@@ -111,7 +108,12 @@ protected function getExpectedNormalizedEntity() {
],
'revision_log'
=>
[],
'changed'
=>
[
$this
->
formatExpectedTimestampItemValues
(
$this
->
entity
->
getChangedTime
()),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
((
int
)
$this
->
entity
->
getChangedTime
())
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'revision_id'
=>
[
[
...
...
@@ -119,7 +121,12 @@ protected function getExpectedNormalizedEntity() {
],
],
'revision_created'
=>
[
$this
->
formatExpectedTimestampItemValues
((
int
)
$this
->
entity
->
getRevisionCreationTime
()),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
((
int
)
$this
->
entity
->
getRevisionCreationTime
())
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'revision_user'
=>
[],
'revision_translation_affected'
=>
[
...
...
@@ -170,10 +177,6 @@ protected function getNormalizedPostEntity() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
...
...
core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
View file @
720924f7
...
...
@@ -7,14 +7,13 @@
use
Drupal\comment\Tests\CommentTestTrait
;
use
Drupal\Core\Cache\Cache
;
use
Drupal\entity_test
\
Entity\EntityTest
;
use
Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait
;
use
Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
;
use
Drupal\user\Entity\User
;
use
GuzzleHttp\RequestOptions
;
abstract
class
CommentResourceTestBase
extends
EntityResourceTestBase
{
use
CommentTestTrait
,
BcTimestampNormalizerUnixTestTrait
;
use
CommentTestTrait
;
/**
* {@inheritdoc}
...
...
@@ -150,10 +149,16 @@ protected function getExpectedNormalizedEntity() {
],
],
'created'
=>
[
$this
->
formatExpectedTimestampItemValues
(
123456789
),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
(
123456789
)
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'changed'
=>
[
$this
->
formatExpectedTimestampItemValues
(
$this
->
entity
->
getChangedTime
()),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
((
int
)
$this
->
entity
->
getChangedTime
())
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'default_langcode'
=>
[
[
...
...
@@ -308,10 +313,6 @@ public function testPostDxWithoutCriticalBaseFields() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
switch
(
$method
)
{
case
'GET'
;
return
"The 'access comments' permission is required and the comment must be published."
;
...
...
core/modules/contact/tests/src/Functional/Rest/ContactFormResourceTestBase.php
View file @
720924f7
...
...
@@ -3,13 +3,10 @@
namespace
Drupal\Tests\contact\Functional\Rest
;
use
Drupal\contact\Entity\ContactForm
;
use
Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait
;
use
Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
;
abstract
class
ContactFormResourceTestBase
extends
EntityResourceTestBase
{
use
BcTimestampNormalizerUnixTestTrait
;
/**
* {@inheritdoc}
*/
...
...
@@ -94,10 +91,6 @@ protected function getNormalizedPostEntity() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
return
"The 'access site-wide contact form' permission is required."
;
}
...
...
core/modules/contact/tests/src/Functional/Rest/MessageResourceTestBase.php
View file @
720924f7
...
...
@@ -101,10 +101,6 @@ protected function getExpectedNormalizedEntity() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
if
(
$method
===
'POST'
)
{
return
"The 'access site-wide contact form' permission is required."
;
}
...
...
core/modules/dblog/tests/src/Functional/DbLogResourceTest.php
View file @
720924f7
...
...
@@ -79,7 +79,7 @@ public function testWatchdog() {
$this
->
setUpAuthorization
(
'GET'
);
$response
=
$this
->
request
(
'GET'
,
$url
,
$request_options
);
$this
->
assertResourceResponse
(
200
,
FALSE
,
$response
,
[
'config:rest.resource.dblog'
,
'config:rest.settings'
,
'http_response'
],
[
'user.permissions'
],
FALSE
,
'MISS'
);
$this
->
assertResourceResponse
(
200
,
FALSE
,
$response
,
[
'config:rest.resource.dblog'
,
'http_response'
],
[
'user.permissions'
],
FALSE
,
'MISS'
);
$log
=
Json
::
decode
((
string
)
$response
->
getBody
());
$this
->
assertEqual
(
$log
[
'wid'
],
$id
,
'Log ID is correct.'
);
$this
->
assertEqual
(
$log
[
'type'
],
'rest'
,
'Type of log message is correct.'
);
...
...
core/modules/editor/tests/src/Functional/Rest/EditorResourceTestBase.php
View file @
720924f7
...
...
@@ -174,10 +174,6 @@ protected function getExpectedCacheContexts() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
return
"The 'administer filters' permission is required."
;
}
...
...
core/modules/field/tests/src/Functional/Rest/FieldConfigResourceTestBase.php
View file @
720924f7
...
...
@@ -109,10 +109,6 @@ protected function getExpectedCacheContexts() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
return
"The 'administer node fields' permission is required."
;
}
...
...
core/modules/field/tests/src/Functional/Rest/FieldStorageConfigResourceTestBase.php
View file @
720924f7
...
...
@@ -79,10 +79,6 @@ protected function getNormalizedPostEntity() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
switch
(
$method
)
{
case
'GET'
:
return
"The 'administer node fields' permission is required."
;
...
...
core/modules/file/src/Plugin/rest/resource/FileUploadResource.php
View file @
720924f7
...
...
@@ -48,7 +48,7 @@
* label = @Translation("File Upload"),
* serialization_class = "Drupal\file\Entity\File",
* uri_paths = {
* "
https://www.drupal.org/link-relations/
create" = "/file/upload/{entity_type_id}/{bundle}/{field_name}"
* "create" = "/file/upload/{entity_type_id}/{bundle}/{field_name}"
* }
* )
*/
...
...
core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php
View file @
720924f7
...
...
@@ -3,14 +3,11 @@
namespace
Drupal\Tests\file\Functional\Rest
;
use
Drupal\file\Entity\File
;
use
Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait
;
use
Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
;
use
Drupal\user\Entity\User
;
abstract
class
FileResourceTestBase
extends
EntityResourceTestBase
{
use
BcTimestampNormalizerUnixTestTrait
;
/**
* {@inheritdoc}
*/
...
...
@@ -109,10 +106,16 @@ protected function createEntity() {
protected
function
getExpectedNormalizedEntity
()
{
return
[
'changed'
=>
[
$this
->
formatExpectedTimestampItemValues
(
$this
->
entity
->
getChangedTime
()),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
(
$this
->
entity
->
getChangedTime
())
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'created'
=>
[
$this
->
formatExpectedTimestampItemValues
((
int
)
$this
->
entity
->
getCreatedTime
()),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
((
int
)
$this
->
entity
->
getCreatedTime
())
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'fid'
=>
[
[
...
...
@@ -217,13 +220,6 @@ public function testPost() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
if
(
$method
===
'DELETE'
)
{
return
'Only the file owner can update or delete the file entity.'
;
}
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
if
(
$method
===
'GET'
)
{
return
"The 'access content' permission is required."
;
}
...
...
core/modules/image/tests/src/Functional/Rest/ImageStyleResourceTestBase.php
View file @
720924f7
...
...
@@ -105,10 +105,6 @@ protected function getNormalizedPostEntity() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
return
"The 'administer image styles' permission is required."
;
}
...
...
core/modules/jsonapi/tests/src/Functional/EntityTestTest.php
View file @
720924f7
...
...
@@ -6,7 +6,6 @@
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\Core\Url
;
use
Drupal\entity_test
\
Entity\EntityTest
;
use
Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait
;
use
Drupal\user\Entity\User
;
/**
...
...
@@ -16,8 +15,6 @@
*/
class
EntityTestTest
extends
ResourceTestBase
{
use
BcTimestampNormalizerUnixTestTrait
;
/**
* {@inheritdoc}
*/
...
...
core/modules/jsonapi/tests/src/Functional/FileTest.php
View file @
720924f7
...
...
@@ -7,7 +7,6 @@
use
Drupal\Core\Url
;
use
Drupal\file\Entity\File
;
use
Drupal\Tests\jsonapi\Traits\CommonCollectionFilterAccessTestPatternsTrait
;
use
Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait
;
use
Drupal\user\Entity\User
;
use
GuzzleHttp\RequestOptions
;
...
...
@@ -18,7 +17,6 @@
*/
class
FileTest
extends
ResourceTestBase
{
use
BcTimestampNormalizerUnixTestTrait
;
use
CommonCollectionFilterAccessTestPatternsTrait
;
/**
...
...
core/modules/jsonapi/tests/src/Functional/ItemTest.php
View file @
720924f7
...
...
@@ -4,7 +4,6 @@
use
Drupal\aggregator\Entity\Feed
;
use
Drupal\aggregator\Entity\Item
;
use
Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait
;
/**
* JSON:API integration test for the "Item" content entity type.
...
...
@@ -13,8 +12,6 @@
*/
class
ItemTest
extends
ResourceTestBase
{
use
BcTimestampNormalizerUnixTestTrait
;
/**
* {@inheritdoc}
*/
...
...
core/modules/layout_builder/tests/src/Functional/Rest/OverrideSectionsTest.php
View file @
720924f7
...
...
@@ -53,7 +53,6 @@ public function testOverrideField() {
[
'config:filter.format.plain_text'
,
'config:rest.resource.entity.node'
,
'config:rest.settings'
,
'http_response'
,
'node:1'
,
],
...
...
core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php
View file @
720924f7
...
...
@@ -8,7 +8,6 @@
use
Drupal\media\Entity\Media
;
use
Drupal\media\Entity\MediaType
;
use
Drupal\rest\RestResourceConfigInterface
;
use
Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait
;
use
Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
;
use
Drupal\user\Entity\Role
;
use
Drupal\user\Entity\User
;
...
...
@@ -17,8 +16,6 @@
abstract
class
MediaResourceTestBase
extends
EntityResourceTestBase
{
use
BcTimestampNormalizerUnixTestTrait
;
/**
* {@inheritdoc}
*/
...
...
@@ -197,13 +194,22 @@ protected function getExpectedNormalizedEntity() {
],
],
'created'
=>
[
$this
->
formatExpectedTimestampItemValues
(
123456789
),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
(
123456789
)
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'changed'
=>
[
$this
->
formatExpectedTimestampItemValues
(
$this
->
entity
->
getChangedTime
()),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
((
int
)
$this
->
entity
->
getChangedTime
())
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'revision_created'
=>
[
$this
->
formatExpectedTimestampItemValues
((
int
)
$this
->
entity
->
getRevisionCreationTime
()),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
((
int
)
$this
->
entity
->
getRevisionCreationTime
())
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'default_langcode'
=>
[
[
...
...
@@ -271,10 +277,6 @@ protected function getNormalizedPatchEntity() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
switch
(
$method
)
{
case
'GET'
;
return
"The 'view media' permission is required when the media item is published."
;
...
...
@@ -425,10 +427,16 @@ protected function getExpectedNormalizedFileEntity() {
],
],
'created'
=>
[
$this
->
formatExpectedTimestampItemValues
(
$file
->
getCreatedTime
()),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
(
$file
->
getCreatedTime
())
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'changed'
=>
[
$this
->
formatExpectedTimestampItemValues
(
$file
->
getChangedTime
()),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
(
$file
->
getChangedTime
())
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
];
}
...
...
core/modules/menu_link_content/tests/src/Functional/Rest/MenuLinkContentResourceTestBase.php
View file @
720924f7
...
...
@@ -3,7 +3,6 @@
namespace
Drupal\Tests\menu_link_content\Functional\Rest
;
use
Drupal\menu_link_content
\
Entity\MenuLinkContent
;
use
Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait
;
use
Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
;
/**
...
...
@@ -11,8 +10,6 @@
*/
abstract
class
MenuLinkContentResourceTestBase
extends
EntityResourceTestBase
{
use
BcTimestampNormalizerUnixTestTrait
;
/**
* {@inheritdoc}
*/
...
...
@@ -188,7 +185,12 @@ protected function getExpectedNormalizedEntity() {
],
],
'changed'
=>
[
$this
->
formatExpectedTimestampItemValues
(
$this
->
entity
->
getChangedTime
()),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
(
$this
->
entity
->
getChangedTime
())
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'default_langcode'
=>
[
[
...
...
@@ -197,7 +199,12 @@ protected function getExpectedNormalizedEntity() {
],
'parent'
=>
[],
'revision_created'
=>
[
$this
->
formatExpectedTimestampItemValues
((
int
)
$this
->
entity
->
getRevisionCreationTime
()),
[
'value'
=>
(
new
\
DateTime
())
->
setTimestamp
((
int
)
$this
->
entity
->
getRevisionCreationTime
())
->
setTimezone
(
new
\
DateTimeZone
(
'UTC'
))
->
format
(
\
DateTime
::
RFC3339
),
'format'
=>
\
DateTime
::
RFC3339
,
],
],
'revision_user'
=>
[],
'revision_log_message'
=>
[],
...
...
@@ -213,10 +220,6 @@ protected function getExpectedNormalizedEntity() {
* {@inheritdoc}
*/
protected
function
getExpectedUnauthorizedAccessMessage
(
$method
)
{
if
(
$this
->
config
(
'rest.settings'
)
->
get
(
'bc_entity_resource_permissions'
))
{
return
parent
::
getExpectedUnauthorizedAccessMessage
(
$method
);
}
switch
(
$method
)
{
case
'DELETE'
:
return
"The 'administer menu' permission is required."
;
...
...
Prev
1
2
3
4
5
…
7
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment