You are here

public function MysqlDateSqlTest::testGetDateField in Drupal 8

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

Tests the getDateField method.

@covers ::getDateField

File

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

Class

MysqlDateSqlTest
Tests the MySQL-specific date query handler.

Namespace

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

Code

public function testGetDateField() {
  $date_sql = new MysqlDateSql($this->database);
  $expected = 'foo.field';
  $this
    ->assertEquals($expected, $date_sql
    ->getDateField('foo.field', TRUE));
  $expected = "DATE_ADD('19700101', INTERVAL foo.field SECOND)";
  $this
    ->assertEquals($expected, $date_sql
    ->getDateField('foo.field', FALSE));
}