Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023
This commit is contained in:
parent
2720a9ec4b
commit
f3791f1da3
1898 changed files with 54300 additions and 11481 deletions
|
|
@ -53,15 +53,23 @@ class CommentFieldAccessTest extends EntityUnitTestBase {
|
|||
protected $readOnlyFields = array(
|
||||
'changed',
|
||||
'hostname',
|
||||
'uuid',
|
||||
'cid',
|
||||
'thread',
|
||||
'comment_type',
|
||||
);
|
||||
|
||||
/**
|
||||
* These fields can be edited on create only.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $createOnlyFields = [
|
||||
'uuid',
|
||||
'pid',
|
||||
'comment_type',
|
||||
'entity_id',
|
||||
'entity_type',
|
||||
'field_name',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* These fields can only be edited by the admin or anonymous users if allowed.
|
||||
|
|
@ -252,6 +260,28 @@ class CommentFieldAccessTest extends EntityUnitTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
// Check create-only fields.
|
||||
foreach ($this->createOnlyFields as $field) {
|
||||
// Check view operation.
|
||||
foreach ($permutations as $set) {
|
||||
$may_view = $set['comment']->{$field}->access('view', $set['user']);
|
||||
$may_update = $set['comment']->{$field}->access('edit', $set['user']);
|
||||
$this->assertEqual($may_view, $field != 'hostname' && ($set['user']->hasPermission('administer comments') ||
|
||||
($set['comment']->isPublished() && $set['user']->hasPermission('access comments'))), SafeMarkup::format('User @user !state view field !field on comment @comment', [
|
||||
'@user' => $set['user']->getUsername(),
|
||||
'!state' => $may_view ? 'can' : 'cannot',
|
||||
'@comment' => $set['comment']->getSubject(),
|
||||
'!field' => $field,
|
||||
]));
|
||||
$this->assertEqual($may_update, $set['user']->hasPermission('post comments') && $set['comment']->isNew(), SafeMarkup::format('User @user !state update field !field on comment @comment', [
|
||||
'@user' => $set['user']->getUsername(),
|
||||
'!state' => $may_update ? 'can' : 'cannot',
|
||||
'@comment' => $set['comment']->getSubject(),
|
||||
'!field' => $field,
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
// Check contact fields.
|
||||
foreach ($this->contactFields as $field) {
|
||||
// Check view operation.
|
||||
|
|
|
|||
Reference in a new issue