diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/RelationshipJoinTestBase.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/RelationshipJoinTestBase.php new file mode 100644 index 0000000..63a9f23 --- /dev/null +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/RelationshipJoinTestBase.php @@ -0,0 +1,70 @@ +enableViewsTestModule(); + } + + /** + * Overrides \Drupal\views\Tests\ViewTestBase::schemaDefinition(). + * + * Adds a uid column to test the relationships. + */ + protected function schemaDefinition() { + $schema = parent::schemaDefinition(); + + $schema['views_test_data']['fields']['uid'] = array( + 'description' => "The {users}.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'] = array( + 'title' => t('UID'), + 'help' => t('The test data UID'), + 'relationship' => array( + 'id' => 'standard', + 'base' => 'users', + 'base field' => 'uid' + ) + ); + + return $data; + } + +}