function SqliteDateSqlTest::providerTestGetDateFormat

Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/Plugin/views/query/SqliteDateSqlTest.php \Drupal\Tests\views\Unit\Plugin\views\query\SqliteDateSqlTest::providerTestGetDateFormat()
  2. 8.9.x core/modules/views/tests/src/Unit/Plugin/views/query/SqliteDateSqlTest.php \Drupal\Tests\views\Unit\Plugin\views\query\SqliteDateSqlTest::providerTestGetDateFormat()
  3. 10 core/modules/views/tests/src/Unit/Plugin/views/query/SqliteDateSqlTest.php \Drupal\Tests\views\Unit\Plugin\views\query\SqliteDateSqlTest::providerTestGetDateFormat()

Provider for date formatting test.

File

core/modules/views/tests/src/Unit/Plugin/views/query/SqliteDateSqlTest.php, line 68

Class

SqliteDateSqlTest
Tests the MySQL-specific date query handler.

Namespace

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

Code

public static 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)",
        ],
    ];
}

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