Skip to content
RelationshipRepresentativeNode.php 1.14 KiB
Newer Older
 * Contains \Drupal\user\Tests\Views\RelationshipRepresentativeNode.

/**
 * Tests the representative node relationship for users.
 */
class RelationshipRepresentativeNode extends UserTestBase {

  /**
   * Views used by this test.
   *
   * @var array
   */
  public static $testViews = array('test_groupwise_user');

  public static function getInfo() {
    return array(
      'name' => 'User: Representative Node Relationship',
      'description' => 'Tests the representative node relationship for users.',
      'group' => 'Views module integration',
    );
  }

  /**
   * Tests the relationship.
   */
  public function testRelationship() {
    $view = views_get_view('test_groupwise_user');
    $this->executeView($view);
    $map = array('node_users_nid' => 'nid', 'uid' => 'uid');
    $expected_result = array(
      array(
        'uid' => $this->users[1]->uid,
        'nid' => $this->nodes[1]->nid,
      ),
      array(
        'uid' => $this->users[0]->uid,
        'nid' => $this->nodes[0]->nid,
      ),
    );
    $this->assertIdenticalResultset($view, $expected_result, $map);
  }

}