public function DrupalTest::testEntityQuery in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/DrupalTest.php \Drupal\Tests\Core\DrupalTest::testEntityQuery()
- 9 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 249
Class
- DrupalTest
- Tests the Drupal class.
Namespace
Drupal\Tests\CoreCode
public function testEntityQuery() {
$query = $this
->createMock(QueryInterface::class);
$storage = $this
->createMock(EntityStorageInterface::class);
$storage
->expects($this
->once())
->method('getQuery')
->with('OR')
->willReturn($query);
$entity_type_manager = $this
->createMock(EntityTypeManagerInterface::class);
$entity_type_manager
->expects($this
->once())
->method('getStorage')
->with('test_entity')
->willReturn($storage);
$this
->setMockContainerService('entity_type.manager', $entity_type_manager);
$this
->assertInstanceOf(QueryInterface::class, \Drupal::entityQuery('test_entity', 'OR'));
}