6af661e665166d30ae06e88d481e562594e7e519
[yaffs-website] / web / core / modules / user / tests / src / Functional / Views / RelationshipRepresentativeNodeTest.php
1 <?php
2
3 namespace Drupal\Tests\user\Functional\Views;
4
5 use Drupal\views\Views;
6
7 /**
8  * Tests the representative node relationship for users.
9  *
10  * @group user
11  */
12 class RelationshipRepresentativeNodeTest extends UserTestBase {
13
14   /**
15    * Views used by this test.
16    *
17    * @var array
18    */
19   public static $testViews = ['test_groupwise_user'];
20
21   /**
22    * Tests the relationship.
23    */
24   public function testRelationship() {
25     $view = Views::getView('test_groupwise_user');
26     $this->executeView($view);
27     $map = ['node_field_data_users_field_data_nid' => 'nid', 'uid' => 'uid'];
28     $expected_result = [
29       [
30         'uid' => $this->users[1]->id(),
31         'nid' => $this->nodes[1]->id(),
32       ],
33       [
34         'uid' => $this->users[0]->id(),
35         'nid' => $this->nodes[0]->id(),
36       ],
37     ];
38     $this->assertIdenticalResultset($view, $expected_result, $map);
39   }
40
41 }