/**
* Tests date formatting replacement.
*
* @covers ::getDateFormat
*
* @dataProvider providerTestGetDateFormat
*/
public function testGetDateFormat($field,
$format,
$expected) { $date_sql =
new SqliteDateSql($this->database
);
$this->
assertEquals($expected,
$date_sql->
getDateFormat($field,
$format));
} /**
* Provider for date formatting test.
*/
public function providerTestGetDateFormat() { return [ ['foo.field', 'Y-y-M-m', "strftime('%Y-%Y-%m-%m', foo.field, 'unixepoch')"
],
['bar.field', 'n-F D d l', "strftime('%m-%m %d %d %d', bar.field, 'unixepoch')"
],
['baz.bar_field', 'j/W/H-h i s A', "strftime('%d/%W/%H-%H %M %S ', baz.bar_field, 'unixepoch')"
],
['foo.field', 'W', "CAST(((strftime('%j', date(strftime('%Y-%m-%d', foo.field, 'unixepoch'), '-3 days', 'weekday 4')) - 1) / 7 + 1) AS NUMERIC)"
],
];