You are here

public function MysqlDateSqlTest::testGetDateFormat 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::testGetDateFormat()

Tests date formatting replacement.

@covers ::getDateFormat

@dataProvider providerTestGetDateFormat

File

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

Class

MysqlDateSqlTest
Tests the MySQL-specific date query handler.

Namespace

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

Code

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