setFieldTimezoneOffset example



  /** * Tests timezone offset formatting. * * @covers ::setFieldTimezoneOffset */
  public function testSetFieldTimezoneOffset() {
    $date_sql = new PostgresqlDateSql($this->database);

    $field = 'foobar.field';
    $date_sql->setFieldTimezoneOffset($field, 42);
    $this->assertEquals("(foobar.field + INTERVAL '42 SECONDS')", $field);
  }

  /** * Tests setting the database offset. * * @covers ::setTimezoneOffset */
  public function testSetTimezoneOffset() {
    $database = $this->prophesize(Connection::class);
    $database->query("SET TIME ZONE INTERVAL '42' HOUR TO MINUTE")->shouldBeCalledTimes(1);
    


  /** * Tests timezone offset formatting. * * @covers ::setFieldTimezoneOffset */
  public function testSetFieldTimezoneOffset() {
    $date_sql = new MysqlDateSql($this->database);

    $field = 'foobar.field';
    $date_sql->setFieldTimezoneOffset($field, 42);
    $this->assertEquals("(foobar.field + INTERVAL 42 SECOND)", $field);
  }

  /** * Tests setting the database offset. * * @covers ::setTimezoneOffset */
  public function testSetTimezoneOffset() {
    $database = $this->prophesize(Connection::class);
    $database->query("SET @@session.time_zone = '42'")->shouldBeCalledTimes(1);
    
public function aggregationMethodDistinct($group_type$field) {
    $group_type = str_replace('_distinct', '', $group_type);
    return strtoupper($group_type) . '(DISTINCT ' . $field . ')';
  }

  /** * {@inheritdoc} */
  public function getDateField($field$string_date = FALSE, $calculate_offset = TRUE) {
    $field = $this->dateSql->getDateField($field$string_date);
    if ($calculate_offset && $offset = $this->getTimezoneOffset()) {
      $this->setFieldTimezoneOffset($field$offset);
    }
    return $field;
  }

  /** * {@inheritdoc} */
  public function setFieldTimezoneOffset(&$field$offset) {
    $this->dateSql->setFieldTimezoneOffset($field$offset);
  }

  


  /** * Tests timezone offset formatting. * * @covers ::setFieldTimezoneOffset */
  public function testSetFieldTimezoneOffset() {
    $date_sql = new SqliteDateSql($this->database);

    $field = 'foobar.field';
    $date_sql->setFieldTimezoneOffset($field, 42);
    $this->assertEquals("(foobar.field + 42)", $field);
  }

  /** * Tests setting the database offset. * * @covers ::setTimezoneOffset */
  public function testSetTimezoneOffset() {
    $database = $this->prophesize(Connection::class);
    $database->query()->shouldNotBeCalled();
    
Home | Imprint | This part of the site doesn't use cookies.