Change entity creation tasks in RssTest to use API calls

Created on 23 August 2022, about 2 years ago
Updated 7 March 2023, over 1 year ago

Problem/Motivation

The test class description says:

* Ensure that data added as terms appears in RSS feeds if "RSS Category" format
* is selected.

and the test method docs say:

* Tests that terms added to nodes are displayed in core RSS feed.

Therefore, this test is about the RSS output, and these steps to create the terms and nodes and configure them are part of the setup, not part of what is being tested:

    // Post an article.
    $edit = [];
    $edit['title[0][value]'] = $this->randomMachineName();
    $edit[$this->fieldName . '[]'] = $term1->id();
    $this->drupalGet('node/add/article');
    $this->submitForm($edit, 'Save');

Steps to reproduce

Proposed resolution

Change the browser requests being done for setup to API calls.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Fixed

Version

10.1 ✨

Component
TaxonomyΒ  β†’

Last updated 5 days ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @xjm
  • πŸ‡¬πŸ‡§United Kingdom @catch
Created by

πŸ‡¬πŸ‡§United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Missed the 9.5 window

    At this time we will need a D10 MR.

    Hiding the patch files to avoid review confusion.

  • First commit to issue fork.
  • @rpayanm opened merge request.
  • Status changed to Needs review almost 2 years ago
  • Status changed to RTBC almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thanks @rpayanm

    Refactor of the test looks good.

  • Status changed to Needs work almost 2 years ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    @joachim, thanks for writing up the steps you took to resolve this. I followed those steps and it was easy to follow and understand why you made the changes you did. I hope others find it useful.

    As the issue summary states the changes here are part of the setup, not the actual test. Therefore, why are these changes not in the setUp method? I think they should be moved there. There is only one test method in this file, so there won't be any conflicts.

  • Status changed to Needs review almost 2 years ago
  • πŸ‡¬πŸ‡§United Kingdom joachim

    I've rebased on to 10.1.

    > As the issue summary states the changes here are part of the setup, not the actual test. Therefore, why are these changes not in the setUp method? I think they should be moved there. There is only one test method in this file, so there won't be any conflicts.

    I really don't think it's worth the effort. First, it would mean having to declare the term entities as class properties instead of them just being local vars:

     $term1 = $this->createTerm($this->vocabulary);
    

    Second, and this is purely a personal feeling, I tend to do modules and config setup in setUp() and create content entities in the test method. Then again, creating $this->user is often done in setUp().

    Third, it makes no difference since there is only one test method, but if ever we wanted to add to the test, or split the test method, it would lead to more work.

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    MR 2659 is showing 1000s of file changes now. Not sure what the fix was or if it was a change to the RssTest.php only.

  • Status changed to Needs review over 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom joachim

    I forgot to change the target branch on the MR. Sorted now.

  • Status changed to RTBC over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    MR 2659 looking at the changes to RssTest.php and they look fine and don't seem to break anything.

  • πŸ‡¬πŸ‡§United Kingdom catch

    Committed 75110eb and pushed to 10.1.x. Thanks!

  • Status changed to Fixed over 1 year ago
    • catch β†’ committed 75110eb0 on 10.1.x
      Issue #3305413 by joachim, Anchal_gupta, rpayanm, smustgrave, quietone:...
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024