ExceptionHandler example

    // the $options parameter.     $options['init_commands']['sql_mode'] = '';
    $connection = new Connection($this->createMock(StubPDO::class)$options);
    $this->assertInstanceOf(Connection::class$connection);
  }

  /** * @covers Drupal\Core\Database\Driver\mysql\ExceptionHandler */
  public function testDeprecationExceptionHandler() {
    $this->expectDeprecation('\Drupal\Core\Database\Driver\mysql\ExceptionHandler is deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. The MySQL database driver has been moved to the mysql module. See https://www.drupal.org/node/3129492');
    $handler = new ExceptionHandler();
    $this->assertInstanceOf(ExceptionHandler::class$handler);
  }

  /** * @covers Drupal\Core\Database\Driver\mysql\Insert */
  public function testDeprecationInsert() {
    $this->expectDeprecation('\Drupal\Core\Database\Driver\mysql\Insert is deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. The MySQL database driver has been moved to the mysql module. See https://www.drupal.org/node/3129492');
    $insert = new Insert($this->connection, 'test');
    $this->assertInstanceOf(Insert::class$insert);
  }

  

    public function handler(int $statusCode, Throwable $exception): ExceptionHandlerInterface
    {
        return new ExceptionHandler($this);
    }
}
Home | Imprint | This part of the site doesn't use cookies.