$filters = $view->displayHandlers->get('default')->getOption('filters');
             $filters['field_date_value']['type'] = 'Date';
On testDateTimeSchema(), the $filters variable is initialized, but never used.

That variable should be used as intended in #2895544: Datetime module missing view plugin config schema.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

shaktik created an issue. See original summary.

shaktik’s picture

Status: Active » Needs review
FileSize
726 bytes
sharma.amitt16’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php
@@ -36,8 +36,6 @@ public function testDateTimeSchema() {
-    $filters['field_date_value']['type'] = 'Date';

The patch is removing the unused variable successfully.

Changing the status to RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I think this shows that that test is a little bit incomplete. I think this test was trying to show that regardless of whether the config is

      filters:
        field_date_value:
          id: field_date_value
          table: node__field_date
          field: field_date_value
          plugin_id: datetime

or is

      filters:
        field_date_value:
          id: field_date_value
          table: node__field_date
          field: field_date_value
          plugin_id: date

the schema is valid.

This was added in #2895544: Datetime module missing view plugin config schema

I think this is meant to be

    $filters['field_date_value']['plugin_id'] = 'date';
    $view->displayHandlers->get('default')->overrideOption('filters', $filters);
Lendude’s picture

Title: Remove Unused variable $filters from DateTimeSchemaTest.php file » Use unused variable $filters from DateTimeSchemaTest
Issue summary: View changes
Status: Needs work » Needs review
FileSize
832 bytes

@alexpott I agree, that does seem to be the intent. It's green when changed, so it seems better to add that and have coverage for that then taking it out.

Updated the IS.

Krzysztof Domański’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 1476de31ad to 9.1.x and 2dc6a5970e to 9.0.x and 1c57be3adf to 8.9.x. Thanks!

  • alexpott committed 1476de3 on 9.1.x
    Issue #3157369 by shaktik, Lendude, alexpott: Use unused variable $...

  • alexpott committed 2dc6a59 on 9.0.x
    Issue #3157369 by shaktik, Lendude, alexpott: Use unused variable $...

  • alexpott committed 1c57be3 on 8.9.x
    Issue #3157369 by shaktik, Lendude, alexpott: Use unused variable $...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.