function PostgresqlDateSqlTest::testGetDateField

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Unit/Plugin/views/query/PostgresqlDateSqlTest.php \Drupal\Tests\views\Unit\Plugin\views\query\PostgresqlDateSqlTest::testGetDateField()
  2. 10 core/modules/views/tests/src/Unit/Plugin/views/query/PostgresqlDateSqlTest.php \Drupal\Tests\views\Unit\Plugin\views\query\PostgresqlDateSqlTest::testGetDateField()
  3. 11.x core/modules/views/tests/src/Unit/Plugin/views/query/PostgresqlDateSqlTest.php \Drupal\Tests\views\Unit\Plugin\views\query\PostgresqlDateSqlTest::testGetDateField()

Tests the getDateField method.

@covers ::getDateField

File

core/modules/views/tests/src/Unit/Plugin/views/query/PostgresqlDateSqlTest.php, line 38

Class

PostgresqlDateSqlTest
Tests the PostgreSQL-specific date query handler.

Namespace

Drupal\Tests\views\Unit\Plugin\views\query

Code

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));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.