class RelationshipRepresentativeNodeTest
Same name in this branch
- 9 core/modules/taxonomy/tests/src/Functional/Views/RelationshipRepresentativeNodeTest.php \Drupal\Tests\taxonomy\Functional\Views\RelationshipRepresentativeNodeTest
Same name and namespace in other branches
- 11.x core/modules/taxonomy/tests/src/Kernel/Views/RelationshipRepresentativeNodeTest.php \Drupal\Tests\taxonomy\Kernel\Views\RelationshipRepresentativeNodeTest
- 11.x core/modules/user/tests/src/Kernel/Views/RelationshipRepresentativeNodeTest.php \Drupal\Tests\user\Kernel\Views\RelationshipRepresentativeNodeTest
- 10 core/modules/taxonomy/tests/src/Kernel/Views/RelationshipRepresentativeNodeTest.php \Drupal\Tests\taxonomy\Kernel\Views\RelationshipRepresentativeNodeTest
- 10 core/modules/user/tests/src/Kernel/Views/RelationshipRepresentativeNodeTest.php \Drupal\Tests\user\Kernel\Views\RelationshipRepresentativeNodeTest
Tests the representative node relationship for users.
@group user
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\user\Kernel\Views\RelationshipRepresentativeNodeTest uses \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\views\Tests\ViewResultAssertionTrait implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of RelationshipRepresentativeNodeTest
File
-
core/
modules/ user/ tests/ src/ Kernel/ Views/ RelationshipRepresentativeNodeTest.php, line 17
Namespace
Drupal\Tests\user\Kernel\ViewsView source
class RelationshipRepresentativeNodeTest extends KernelTestBase {
use NodeCreationTrait;
use UserCreationTrait;
use ViewResultAssertionTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'filter',
'node',
'system',
'user',
'user_test_views',
'views',
];
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = [
'test_groupwise_user',
];
/**
* Tests the relationship.
*/
public function testRelationship() {
$this->installSchema('system', [
'sequences',
]);
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installConfig([
'filter',
]);
ViewTestData::createTestViews(static::class, [
'user_test_views',
]);
$users[] = $this->createUser([], NULL, FALSE, [
'uid' => 2,
]);
$users[] = $this->createUser([], NULL, FALSE, [
'uid' => 1,
]);
$nodes[] = $this->createNode([
'uid' => $users[0]->id(),
]);
$nodes[] = $this->createNode([
'uid' => $users[1]->id(),
]);
$view = Views::getView('test_groupwise_user');
$view->preview();
$map = [
'node_field_data_users_field_data_nid' => 'nid',
'uid' => 'uid',
];
$expected_result = [
[
'uid' => $users[1]->id(),
'nid' => $nodes[1]->id(),
],
[
'uid' => $users[0]->id(),
'nid' => $nodes[0]->id(),
],
];
$this->assertIdenticalResultset($view, $expected_result, $map);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.