Unverified Commit 93045afb authored by larowlan's avatar larowlan

Issue #2895544 by Ginovski, Lendude, mpdonadio, jhedstrom, Berdir, dawehner:...

Issue #2895544 by Ginovski, Lendude, mpdonadio, jhedstrom, Berdir, dawehner: Datetime module missing view plugin config schema
parent fdce9b70
views.argument.datetime:
type: views.argument.date
views.argument.datetime_day:
type: views.argument.datetime
views.argument.datetime_full_date:
type: views.argument.datetime
views.argument.datetime_month:
type: views.argument.datetime
views.argument.datetime_week:
type: views.argument.datetime
views.argument.datetime_year:
type: views.argument.datetime
views.argument.datetime_year_month:
type: views.argument.datetime
views.filter.datetime:
type: views.filter.date
views.filter_value.datetime:
type: views.filter_value.date
views.sort.datetime:
type: views.sort.date
views.sort_expose.datetime:
type: views.sort_expose.date
......@@ -33,6 +33,7 @@ display:
relationship: none
table: node__field_date
order: DESC
granularity: second
plugin_id: datetime
id:
field: nid
......
<?php
namespace Drupal\Tests\datetime\Kernel\Views;
use Drupal\Tests\SchemaCheckTestTrait;
use Drupal\views\Views;
/**
* Tests the Drupal\datetime\Plugin\views schemas.
*
* @group datetime
*/
class DateTimeSchemaTest extends DateTimeHandlerTestBase {
use SchemaCheckTestTrait;
/**
* {@inheritdoc}
*/
public static $testViews = ['test_argument_datetime', 'test_filter_datetime', 'test_sort_datetime'];
/**
* Test argument plugin schema.
*/
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->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');
}
}
......@@ -154,8 +154,8 @@ views.filter_value.date:
type: string
label: 'Type'
views.filter_value.datetime:
type: views.filter_value.numeric
views.filter.date:
type: views.filter.numeric
label: 'Date'
mapping:
type:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment