composer update
This commit is contained in:
parent
f6abc3dce2
commit
71dfaca858
1753 changed files with 45274 additions and 14619 deletions
|
@ -52,7 +52,7 @@ use Drupal\node\NodeInterface;
|
|||
function node_access_test_node_grants($account, $op) {
|
||||
$grants = [];
|
||||
$grants['node_access_test_author'] = [$account->id()];
|
||||
if ($op == 'view' && $account->hasPermission('node test view', $account)) {
|
||||
if ($op == 'view' && $account->hasPermission('node test view')) {
|
||||
$grants['node_access_test'] = [8888, 8889];
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,13 @@ display:
|
|||
plugin_id: field
|
||||
entity_type: node
|
||||
entity_field: nid
|
||||
langcode:
|
||||
id: langcode
|
||||
table: node_field_revision
|
||||
field: langcode
|
||||
plugin_id: field
|
||||
entity_type: node
|
||||
entity_field: langcode
|
||||
arguments:
|
||||
nid:
|
||||
id: nid
|
||||
|
@ -61,6 +68,21 @@ display:
|
|||
plugin_id: field
|
||||
entity_type: node
|
||||
entity_field: vid
|
||||
langcode:
|
||||
id: langcode
|
||||
table: node_field_revision
|
||||
field: langcode
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
order: DESC
|
||||
exposed: false
|
||||
expose:
|
||||
label: ''
|
||||
entity_type: node
|
||||
entity_field: langcode
|
||||
plugin_id: standard
|
||||
display_extenders: { }
|
||||
display_plugin: default
|
||||
display_title: Master
|
||||
id: default
|
||||
|
|
|
@ -44,6 +44,13 @@ display:
|
|||
plugin_id: field
|
||||
entity_type: node
|
||||
entity_field: nid
|
||||
langcode:
|
||||
id: langcode
|
||||
table: node_field_revision
|
||||
field: langcode
|
||||
entity_type: node
|
||||
entity_field: langcode
|
||||
plugin_id: field
|
||||
arguments:
|
||||
nid:
|
||||
id: nid
|
||||
|
@ -52,6 +59,22 @@ display:
|
|||
plugin_id: node_nid
|
||||
entity_type: node
|
||||
entity_field: nid
|
||||
display_extenders: { }
|
||||
sorts:
|
||||
langcode:
|
||||
id: langcode
|
||||
table: node_field_revision
|
||||
field: langcode
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
order: ASC
|
||||
exposed: false
|
||||
expose:
|
||||
label: ''
|
||||
entity_type: node
|
||||
entity_field: langcode
|
||||
plugin_id: standard
|
||||
display_plugin: default
|
||||
display_title: Master
|
||||
id: default
|
||||
|
|
|
@ -153,7 +153,7 @@ class NodeRevisionPermissionsTest extends NodeTestBase {
|
|||
foreach ($permutations as $case) {
|
||||
// Skip this test if there are no revisions for the node.
|
||||
if (!($revision->isDefaultRevision() && (db_query('SELECT COUNT(vid) FROM {node_field_revision} WHERE nid = :nid', [':nid' => $revision->id()])->fetchField() == 1 || $case['op'] == 'update' || $case['op'] == 'delete'))) {
|
||||
if (!empty($case['account']->is_admin) || $case['account']->hasPermission($this->typeMap[$case['op']], $case['account'])) {
|
||||
if (!empty($case['account']->is_admin) || $case['account']->hasPermission($this->typeMap[$case['op']])) {
|
||||
$this->assertTrue($node_revision_access->checkAccess($revision, $case['account'], $case['op']), "{$this->typeMap[$case['op']]} granted.");
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Drupal\Tests\node\Kernel\Views;
|
||||
|
||||
use Drupal\language\Entity\ConfigurableLanguage;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
|
||||
|
@ -20,7 +21,12 @@ class RevisionRelationshipsTest extends ViewsKernelTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['node' , 'node_test_views'];
|
||||
public static $modules = [
|
||||
'node',
|
||||
'node_test_views',
|
||||
'language',
|
||||
'content_translation',
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -33,6 +39,8 @@ class RevisionRelationshipsTest extends ViewsKernelTestBase {
|
|||
$this->installEntitySchema('user');
|
||||
$this->installEntitySchema('node');
|
||||
|
||||
ConfigurableLanguage::createFromLangcode('fr')->save();
|
||||
|
||||
ViewTestData::createTestViews(get_class($this), ['node_test_views']);
|
||||
}
|
||||
|
||||
|
@ -51,16 +59,22 @@ class RevisionRelationshipsTest extends ViewsKernelTestBase {
|
|||
$type->save();
|
||||
$node = Node::create(['type' => 'page', 'title' => 'test', 'uid' => 1]);
|
||||
$node->save();
|
||||
|
||||
// Add a translation.
|
||||
$translation = $node->addTranslation('fr', $node->toArray());
|
||||
$translation->save();
|
||||
// Create revision of the node.
|
||||
$node->setNewRevision(TRUE);
|
||||
$node->save();
|
||||
|
||||
$column_map = [
|
||||
'vid' => 'vid',
|
||||
'node_field_data_node_field_revision_nid' => 'node_node_revision_nid',
|
||||
'nid_1' => 'nid_1',
|
||||
'node_field_revision_langcode' => 'node_field_revision_langcode',
|
||||
];
|
||||
|
||||
// Here should be two rows.
|
||||
// Here should be two rows for each translation.
|
||||
$view_nid = Views::getView('test_node_revision_nid');
|
||||
$this->executeView($view_nid, [$node->id()]);
|
||||
$resultset_nid = [
|
||||
|
@ -68,17 +82,32 @@ class RevisionRelationshipsTest extends ViewsKernelTestBase {
|
|||
'vid' => '1',
|
||||
'node_node_revision_nid' => '1',
|
||||
'nid_1' => '1',
|
||||
'node_field_revision_langcode' => 'fr',
|
||||
],
|
||||
[
|
||||
'vid' => '1',
|
||||
'node_node_revision_nid' => '1',
|
||||
'nid_1' => '1',
|
||||
'node_field_revision_langcode' => 'en',
|
||||
],
|
||||
[
|
||||
'vid' => '2',
|
||||
'node_revision_nid' => '1',
|
||||
'node_node_revision_nid' => '1',
|
||||
'nid_1' => '1',
|
||||
'node_field_revision_langcode' => 'fr',
|
||||
],
|
||||
[
|
||||
'vid' => '2',
|
||||
'node_revision_nid' => '1',
|
||||
'node_node_revision_nid' => '1',
|
||||
'nid_1' => '1',
|
||||
'node_field_revision_langcode' => 'en',
|
||||
],
|
||||
];
|
||||
$this->assertIdenticalResultset($view_nid, $resultset_nid, $column_map);
|
||||
|
||||
// There should be only one row with active revision 2.
|
||||
// There should be one row with active revision 2 for each translation.
|
||||
$view_vid = Views::getView('test_node_revision_vid');
|
||||
$this->executeView($view_vid, [$node->id()]);
|
||||
$resultset_vid = [
|
||||
|
@ -86,6 +115,13 @@ class RevisionRelationshipsTest extends ViewsKernelTestBase {
|
|||
'vid' => '2',
|
||||
'node_node_revision_nid' => '1',
|
||||
'nid_1' => '1',
|
||||
'node_field_revision_langcode' => 'en',
|
||||
],
|
||||
[
|
||||
'vid' => '2',
|
||||
'node_node_revision_nid' => '1',
|
||||
'nid_1' => '1',
|
||||
'node_field_revision_langcode' => 'fr',
|
||||
],
|
||||
];
|
||||
$this->assertIdenticalResultset($view_vid, $resultset_vid, $column_map);
|
||||
|
|
Reference in a new issue