function SqlTest::setupViewWithRelationships

Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php \Drupal\Tests\views\Unit\Plugin\query\SqlTest::setupViewWithRelationships()
  2. 10 core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php \Drupal\Tests\views\Unit\Plugin\query\SqlTest::setupViewWithRelationships()
  3. 11.x core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php \Drupal\Tests\views\Unit\Plugin\query\SqlTest::setupViewWithRelationships()

Create a view with a relationship.

4 calls to SqlTest::setupViewWithRelationships()
SqlTest::testLoadEntitiesWithNonEntityRelationship in core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php
@covers ::loadEntities @covers ::assignEntitiesToResult
SqlTest::testLoadEntitiesWithRelationship in core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php
@covers ::loadEntities @covers ::assignEntitiesToResult
SqlTest::testLoadEntitiesWithRelationshipAndRevision in core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php
@covers ::loadEntities @covers ::assignEntitiesToResult
SqlTest::testLoadEntitiesWithRevisionOfSameEntityType in core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php
@covers ::loadEntities @covers ::assignEntitiesToResult

File

core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php, line 318

Class

SqlTest
@coversDefaultClass \Drupal\views\Plugin\views\query\Sql

Namespace

Drupal\Tests\views\Unit\Plugin\query

Code

protected function setupViewWithRelationships(ViewExecutable $view, $base = 'entity_second') {
    // We don't use prophecy, because prophecy enforces methods.
    $relationship = $this->getMockBuilder(RelationshipPluginBase::class)
        ->disableOriginalConstructor()
        ->getMock();
    $relationship->definition['base'] = $base;
    $relationship->tableAlias = $base;
    $relationship->alias = $base;
    $view->relationship[$base] = $relationship;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.