RelationshipRepresentativeNode.php

Definition of Drupal\views\Tests\User\RelationshipRepresentativeNode.

Namespace

Drupal\views\Tests\User

File

drupal/core/modules/views/lib/Drupal/views/Tests/User/RelationshipRepresentativeNode.php
View source
<?php

/**
 * @file
 * Definition of Drupal\views\Tests\User\RelationshipRepresentativeNode.
 */
namespace Drupal\views\Tests\User;


/**
 * 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 Modules',
    );
  }

  /**
   * 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);
  }

}

Classes

Namesort descending Description
RelationshipRepresentativeNode Tests the representative node relationship for users.