summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Rowlands2017-10-30 08:52:43 +1000
committerLee Rowlands2017-10-30 08:52:43 +1000
commit93045afbe4b7c3c38c4f2777234c65a863cfeac1 (patch)
tree6e208c082d6475d6c99c9313d874bf92b909ce6a
parentfdce9b702e02772ef0915ac046555931b15bc27c (diff)
Issue #2895544 by Ginovski, Lendude, mpdonadio, jhedstrom, Berdir, dawehner: Datetime module missing view plugin config schema
-rw-r--r--core/modules/datetime/config/schema/datetime.views.schema.yml32
-rw-r--r--core/modules/datetime/tests/modules/datetime_test/test_views/views.view.test_sort_datetime.yml1
-rw-r--r--core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php52
-rw-r--r--core/modules/views/config/schema/views.filter.schema.yml4
4 files changed, 87 insertions, 2 deletions
diff --git a/core/modules/datetime/config/schema/datetime.views.schema.yml b/core/modules/datetime/config/schema/datetime.views.schema.yml
new file mode 100644
index 0000000..257ea3b
--- /dev/null
+++ b/core/modules/datetime/config/schema/datetime.views.schema.yml
@@ -0,0 +1,32 @@
+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
diff --git a/core/modules/datetime/tests/modules/datetime_test/test_views/views.view.test_sort_datetime.yml b/core/modules/datetime/tests/modules/datetime_test/test_views/views.view.test_sort_datetime.yml
index de80830..59bcbd9 100644
--- a/core/modules/datetime/tests/modules/datetime_test/test_views/views.view.test_sort_datetime.yml
+++ b/core/modules/datetime/tests/modules/datetime_test/test_views/views.view.test_sort_datetime.yml
@@ -33,6 +33,7 @@ display:
relationship: none
table: node__field_date
order: DESC
+ granularity: second
plugin_id: datetime
id:
field: nid
diff --git a/core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php b/core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php
new file mode 100644
index 0000000..f763c49
--- /dev/null
+++ b/core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php
@@ -0,0 +1,52 @@
+<?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');
+ }
+
+}
diff --git a/core/modules/views/config/schema/views.filter.schema.yml b/core/modules/views/config/schema/views.filter.schema.yml
index 18c13b6..cdaa364 100644
--- a/core/modules/views/config/schema/views.filter.schema.yml
+++ b/core/modules/views/config/schema/views.filter.schema.yml
@@ -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: