function DateTimeSchemaTest::testDateTimeSchema
Same name in other branches
- 9 core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php \Drupal\Tests\datetime\Kernel\Views\DateTimeSchemaTest::testDateTimeSchema()
- 10 core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php \Drupal\Tests\datetime\Kernel\Views\DateTimeSchemaTest::testDateTimeSchema()
- 11.x core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php \Drupal\Tests\datetime\Kernel\Views\DateTimeSchemaTest::testDateTimeSchema()
Test argument plugin schema.
File
-
core/
modules/ datetime/ tests/ src/ Kernel/ Views/ DateTimeSchemaTest.php, line 25
Class
- DateTimeSchemaTest
- Tests the Drupal\datetime\Plugin\views schemas.
Namespace
Drupal\Tests\datetime\Kernel\ViewsCode
public function testDateTimeSchema() {
// Test argument schema.
$view = Views::getView('test_argument_datetime');
$view->initHandlers();
$view->setDisplay('default');
$arguments = $view->displayHandlers
->get('default')
->getOption('arguments');
$arguments['field_date_value_year']['date'] = 'Date';
$view->displayHandlers
->get('default')
->overrideOption('arguments', $arguments);
$view->save();
$this->assertConfigSchemaByName('views.view.test_argument_datetime');
// Test filter schema.
$view = Views::getView('test_filter_datetime');
$view->initHandlers();
$filters = $view->displayHandlers
->get('default')
->getOption('filters');
$filters['field_date_value']['type'] = 'date';
$view->displayHandlers
->get('default')
->overrideOption('filters', $filters);
$view->save();
$this->assertConfigSchemaByName('views.view.test_filter_datetime');
// Test sort schema.
$view = Views::getView('test_sort_datetime');
$view->initHandlers();
$sorts = $view->displayHandlers
->get('default')
->getOption('sorts');
$this->assertNotEmpty($sorts['field_date_value']['granularity']);
$this->assertConfigSchemaByName('views.view.test_sort_datetime');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.