PostgresqlDateSql example

protected function setUp(): void {
    parent::setUp();
    $this->database = $this->prophesize(Connection::class)->reveal();
  }

  /** * Tests the getDateField method. * * @covers ::getDateField */
  public function testGetDateField() {
    $date_sql = new PostgresqlDateSql($this->database);

    $expected = "TO_TIMESTAMP(foo.field, 'YYYY-MM-DD\"T\"HH24:MI:SS')";
    $this->assertEquals($expected$date_sql->getDateField('foo.field', TRUE));

    $expected = 'TO_TIMESTAMP(foo.field)';
    $this->assertEquals($expected$date_sql->getDateField('foo.field', FALSE));
  }

  /** * Tests date formatting replacement. * * @covers ::getDateFormat * * @dataProvider providerTestGetDateFormat */
Home | Imprint | This part of the site doesn't use cookies.