Sql example

/** * @covers ::getCacheTags * @covers ::getAllEntities */
  public function testGetCacheTags() {
    $view = $this->prophesize('Drupal\views\ViewExecutable')->reveal();
    $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
    $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 = [];
    $view->result = $result;

    // Add a row with an entity.     $row = new ResultRow();
    $prophecy = $this->prophesize('Drupal\Core\Entity\EntityInterface');
    $prophecy->getCacheTags()->willReturn(['entity_test:123']);
    $entity = $prophecy->reveal();
    $row->_entity = $entity;

    
/** * {@inheritdoc} */
  protected static $modules = ['migrate'];

  /** * @covers \Drupal\migrate\Plugin\migrate\id_map\Sql::__construct */
  public function testOptionalParametersDeprecation(): void {
    $migration = $this->prophesize('\Drupal\migrate\Plugin\MigrationInterface')->reveal();
    $this->expectDeprecation('Calling Sql::__construct() without the $migration_manager argument is deprecated in drupal:9.5.0 and the $migration_manager argument will be required in drupal:11.0.0. See https://www.drupal.org/node/3277306');
    new Sql(
      [],
      'sql',
      [],
      $migration,
      $this->container->get('event_dispatcher')
    );
  }

}
Home | Imprint | This part of the site doesn't use cookies.