You are here

public function SqliteDateSqlTest::testGetDateField in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Unit/Plugin/views/query/SqliteDateSqlTest.php \Drupal\Tests\views\Unit\Plugin\views\query\SqliteDateSqlTest::testGetDateField()

Tests the getDateField method.

@covers ::getDateField

File

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

Class

SqliteDateSqlTest
Tests the MySQL-specific date query handler.

Namespace

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

Code

public function testGetDateField() {
  $date_sql = new SqliteDateSql($this->database);
  $expected = "strftime('%s', foo.field)";
  $this
    ->assertEquals($expected, $date_sql
    ->getDateField('foo.field', TRUE));
  $expected = 'foo.field';
  $this
    ->assertEquals($expected, $date_sql
    ->getDateField('foo.field', FALSE));
}