You are here

public function DrupalTest::testEntityQuery in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/DrupalTest.php \Drupal\Tests\Core\DrupalTest::testEntityQuery()

Tests the entityQuery() method.

@covers ::entityQuery

File

core/tests/Drupal/Tests/Core/DrupalTest.php, line 237
Contains \Drupal\Tests\Core\DrupalTest.

Class

DrupalTest
Tests the Drupal class.

Namespace

Drupal\Tests\Core

Code

public function testEntityQuery() {
  $query = $this
    ->getMockBuilder('Drupal\\Core\\Entity\\Query\\QueryFactory')
    ->disableOriginalConstructor()
    ->getMock();
  $query
    ->expects($this
    ->once())
    ->method('get')
    ->with('test_entity', 'OR')
    ->will($this
    ->returnValue(TRUE));
  $this
    ->setMockContainerService('entity.query', $query);
  $this
    ->assertNotNull(\Drupal::entityQuery('test_entity', 'OR'));
}