function MysqlDateSqlTest::testGetDateField

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php \Drupal\Tests\views\Unit\Plugin\views\query\MysqlDateSqlTest::testGetDateField()
  2. 10 core/modules/views/tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php \Drupal\Tests\views\Unit\Plugin\views\query\MysqlDateSqlTest::testGetDateField()
  3. 11.x 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));
}

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