function QueryTest::setUp

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php \Drupal\Tests\Core\Entity\Query\Sql\QueryTest::setUp()
  2. 8.9.x core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php \Drupal\Tests\Core\Entity\Query\Sql\QueryTest::setUp()
  3. 10 core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php \Drupal\Tests\Core\Entity\Query\Sql\QueryTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php, line 30

Class

QueryTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Entity%21Query%21Sql%21Query.php/class/Query/11.x" title="The SQL storage entity query class." class="local">\Drupal\Core\Entity\Query\Sql\Query</a> @group Entity

Namespace

Drupal\Tests\Core\Entity\Query\Sql

Code

protected function setUp() : void {
    parent::setUp();
    $entity_type = new EntityType([
        'id' => 'example_entity_query',
    ]);
    $conjunction = 'AND';
    $connection = $this->getMockBuilder('Drupal\\Core\\Database\\Connection')
        ->disableOriginalConstructor()
        ->getMock();
    $namespaces = [
        'Drupal\\Core\\Entity\\Query\\Sql',
    ];
    $this->query = new Query($entity_type, $conjunction, $connection, $namespaces);
    $container = $this->createMock(ContainerInterface::class);
    $container->expects($this->any())
        ->method('get')
        ->with('module_handler')
        ->willReturn($this->createMock(ModuleHandler::class));
    \Drupal::setContainer($container);
}

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