public function SqlTest::testLoadEntitiesWithEmptyResult in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php \Drupal\Tests\views\Unit\Plugin\query\SqlTest::testLoadEntitiesWithEmptyResult()
- 9 core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php \Drupal\Tests\views\Unit\Plugin\query\SqlTest::testLoadEntitiesWithEmptyResult()
@covers ::loadEntities @covers ::assignEntitiesToResult
File
- core/
modules/ views/ tests/ src/ Unit/ Plugin/ query/ SqlTest.php, line 249
Class
- SqlTest
- @coversDefaultClass \Drupal\views\Plugin\views\query\Sql
Namespace
Drupal\Tests\views\Unit\Plugin\queryCode
public function testLoadEntitiesWithEmptyResult() {
$view = $this
->prophesize('Drupal\\views\\ViewExecutable')
->reveal();
$view_entity = $this
->prophesize(ViewEntityInterface::class);
$view_entity
->get('base_table')
->willReturn('entity_first');
$view_entity
->get('base_field')
->willReturn('id');
$view->storage = $view_entity
->reveal();
$entity_type_manager = $this
->setupEntityTypes();
$date_sql = $this
->prophesize(DateSqlInterface::class);
$messenger = $this
->prophesize(MessengerInterface::class);
$query = new Sql([], 'sql', [], $entity_type_manager
->reveal(), $date_sql
->reveal(), $messenger
->reveal());
$query->view = $view;
$result = [];
$query
->addField('entity_first', 'id', 'id');
$query
->loadEntities($result);
$this
->assertEmpty($result);
}