You are here

public function DrupalTest::testEntityQueryAggregate in Zircon Profile 8.0

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

Tests the entityQueryAggregate() method.

@covers ::entityQueryAggregate

File

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

Class

DrupalTest
Tests the Drupal class.

Namespace

Drupal\Tests\Core

Code

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