Problem/Motivation

FilterIdTest prefixes its provider with test meaning its treated like a test by phpunit.

Proposed resolution

Rename the test methods to be more clear and conform to phpunit naming schemes.

Remaining tasks

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Comments

neclimdul created an issue. See original summary.

neclimdul’s picture

Status: Active » Needs review
StatusFileSize
new1.11 KB

Patch

neclimdul’s picture

Success, one fewer reported test.

neclimdul’s picture

Issue tags: +Novice, +PHPUnit
alena_stanul’s picture

You changed name of function testProvider() with description 'The test data provider.'. In my opinion, the description should also be made more clear.

neclimdul’s picture

sure, I was limiting the scope to fixing the method names but we might as well fix the doc too. do you want to roll the patch?

alena_stanul’s picture

I will change to roll patch:
- for testTransform() description from 'The test data provider.' to 'Tests transformation of filter_id plugin.' ;
- for provideFilters() from 'The test data provider.' to 'The test of filter provider.'

alena_stanul’s picture

Were changed descriptions in accordance with the new names of the methods of the class.

borisson_’s picture

Issue tags: -PHPUnit
+++ b/core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterIdTest.php
@@ -78,11 +78,11 @@ public function test($value, $expected_value, $invalid_id = NULL) {
-   * The test data provider.
+   * The test of filter provider.

This doesn't make it any better I think. I'd prefer something like: Provides test filter for ::testTransform.

Or doesn't that make it better?

alena_stanul’s picture

@borisson_ Thanks for your comment. Yes I agree with you to change description for method provideFilters() to 'Provides test filter for ::testTransform.' I Re-rolled the patch.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

This looks solid!

PS: Next time, please provide an interdiff as well as a patch to make reviewing easier.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: fix-FilterIdtest-names-description-2940679-9.patch, failed testing. View results

Mixologic’s picture

Status: Needs work » Reviewed & tested by the community

Temporary testbot hiccup.

neclimdul’s picture

Status: Reviewed & tested by the community » Needs work

I don't think this is ready actually. Also, getting documentation right is hard which is one reason I didn't include it in the original patch. :-D

1) I'm going to push back on the ::testTransform part. Its kind of an anti-pattern in my opinion and doesn't really help anything. It does add maintenance headaches though. Do we document any other method that adds it in the future? What if the method name changes again?
2) The dataset is plural. "filters" not "filter"
3) If we're fixing the documentation, we should be more clear about the structure of the provided dataset.

Something more like:

Provides filter ids for testing transformations.

Formatted as $source_id, $tranformed_id, $invalid_id. When $invalid_id is provided the transformation should fail with the supplied id.

This kinda exposes a failing of the design of this test that the dataset structure is tightly coupled to the logic and code of the test though $invalid_id but we really do need to control some scope here and move forward with getting something fixed. ;)

borisson_’s picture

Status: Needs work » Needs review
StatusFileSize
new829 bytes
new1.58 KB

Fixed #14.

borisson_’s picture

I don't think I can move this back to RTBC because I also added a patch. I just noticed that this issue was novice, sorry about that.

neclimdul’s picture

Status: Needs review » Reviewed & tested by the community

yeah, that's mostly on me for doing the review. Sorry been busy and missed the update.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 15: 2940679.patch, failed testing. View results

neclimdul’s picture

Status: Needs work » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 15: 2940679.patch, failed testing. View results

neclimdul’s picture

Status: Needs work » Reviewed & tested by the community

There are no failed results. I don't know what testbot was upset about but going to reset it again... :-/

  • larowlan committed 69167b5 on 8.6.x
    Issue #2940679 by alena_stanul, borisson_, neclimdul: Fix FilterIdTest...

  • larowlan committed 75c8cdd on 8.5.x
    Issue #2940679 by alena_stanul, borisson_, neclimdul: Fix FilterIdTest...
larowlan’s picture

Version: 8.6.x-dev » 8.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed as 69167b5 and pushed to 8.6.x.

Cherry-picked as 75c8cdd and pushed to 8.5.x.

Can we get a follow up (novice) to add names to the test cases?

e.g from

 // The filter ID is mapped, and the plugin exists.
      [
        'foo',
        'filter_html',
      ],

to


      'filter ID mapped to plugin that exists' => [
        'foo',
        'filter_html',
      ],

The output from phpunit is much easier to understand.

Test case 'Filter ID mapped to plugin that exists' being better than Test case '0'

neclimdul’s picture

Status: Fixed » Closed (fixed)

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