function PostgresqlDateSqlTest::testGetDateFormat

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

Tests date formatting replacement.

@covers ::getDateFormat

@dataProvider providerTestGetDateFormat

File

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

Class

PostgresqlDateSqlTest
Tests the PostgreSQL-specific date query handler.

Namespace

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

Code

public function testGetDateFormat($field, $format, $expected_format) : void {
    $date_sql = new PostgresqlDateSql($this->database);
    $this->assertEquals("TO_CHAR({$field}, '{$expected_format}')", $date_sql->getDateFormat($field, $format));
}

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