function MysqlDateSqlTest::testGetDateField

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()
  2. 8.9.x core/modules/views/tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php \Drupal\Tests\views\Unit\Plugin\views\query\MysqlDateSqlTest::testGetDateField()
  3. 10 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 40

Class

MysqlDateSqlTest
Tests the MySQL-specific date query handler.

Namespace

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

Code

public function testGetDateField() : void {
    $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));
}

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