class RelationshipJoinTestBase
Same name in other branches
- 9 core/modules/views/tests/src/Kernel/Plugin/RelationshipJoinTestBase.php \Drupal\Tests\views\Kernel\Plugin\RelationshipJoinTestBase
- 8.9.x core/modules/views/tests/src/Kernel/Plugin/RelationshipJoinTestBase.php \Drupal\Tests\views\Kernel\Plugin\RelationshipJoinTestBase
- 10 core/modules/views/tests/src/Kernel/Plugin/RelationshipJoinTestBase.php \Drupal\Tests\views\Kernel\Plugin\RelationshipJoinTestBase
Provides a base class for a testing a relationship.
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase extends \Drupal\KernelTests\KernelTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait
- class \Drupal\Tests\views\Kernel\Plugin\PluginKernelTestBase extends \Drupal\Tests\views\Kernel\ViewsKernelTestBase
- class \Drupal\Tests\views\Kernel\Plugin\RelationshipJoinTestBase extends \Drupal\Tests\views\Kernel\Plugin\PluginKernelTestBase
- class \Drupal\Tests\views\Kernel\Plugin\PluginKernelTestBase extends \Drupal\Tests\views\Kernel\ViewsKernelTestBase
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase extends \Drupal\KernelTests\KernelTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait
Expanded class hierarchy of RelationshipJoinTestBase
See also
\Drupal\views\Tests\Handler\JoinTest
\Drupal\views\Tests\Plugin\RelationshipTest
File
-
core/
modules/ views/ tests/ src/ Kernel/ Plugin/ RelationshipJoinTestBase.php, line 17
Namespace
Drupal\Tests\views\Kernel\PluginView source
abstract class RelationshipJoinTestBase extends PluginKernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'system',
'user',
'field',
];
/**
* @var \Drupal\user\Entity\User
*/
protected $rootUser;
/**
* {@inheritdoc}
*/
protected function setUpFixtures() {
$this->installEntitySchema('user');
$this->installConfig([
'user',
]);
parent::setUpFixtures();
// Create a record for uid 1.
$this->rootUser = User::create([
'name' => $this->randomMachineName(),
]);
$this->rootUser
->save();
Views::viewsData()->clear();
}
/**
* Overrides \Drupal\views\Tests\ViewTestBase::schemaDefinition().
*
* Adds a uid column to test the relationships.
*
* @internal
*/
protected function schemaDefinition() {
$schema = parent::schemaDefinition();
$schema['views_test_data']['fields']['uid'] = [
'description' => "The {users_field_data}.uid of the author of the beatle entry.",
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
];
return $schema;
}
/**
* Overrides \Drupal\views\Tests\ViewTestBase::viewsData().
*
* Adds a relationship for the uid column.
*/
protected function viewsData() {
$data = parent::viewsData();
$data['views_test_data']['uid'] = [
'title' => new TranslatableMarkup('UID'),
'help' => new TranslatableMarkup('The test data UID'),
'relationship' => [
'id' => 'standard',
'base' => 'users_field_data',
'base field' => 'uid',
],
];
return $data;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
RelationshipJoinTestBase::$modules | protected static | property | ||
RelationshipJoinTestBase::$rootUser | protected | property | ||
RelationshipJoinTestBase::schemaDefinition | protected | function | Overrides \Drupal\views\Tests\ViewTestBase::schemaDefinition(). | |
RelationshipJoinTestBase::setUpFixtures | protected | function | ||
RelationshipJoinTestBase::viewsData | protected | function | Overrides \Drupal\views\Tests\ViewTestBase::viewsData(). | 1 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.