Problem/Motivation

In #3042745-41: Remove group @legacy from jsonapi tests and fix deprecation messages and #3042745-45: Remove group @legacy from jsonapi tests and fix deprecation messages.2 @Wim Leers and @bnjmnm argued that we should remove \Drupal\Tests\jsonapi\Kernel\Controller\EntityResourceTest

Proposed resolution

Remove \Drupal\Tests\jsonapi\Kernel\Controller\EntityResourceTest

Remaining tasks

Prove we have are not removing test coverage.

User interface changes

N/a

API changes

N/a

Data model changes

N/a

Release notes snippet

N/a

Comments

alexpott created an issue. See original summary.

alexpott credited bnjmnm.

alexpott’s picture

shreyal999’s picture

Assigned: Unassigned » shreyal999
shreyal999’s picture

Status: Active » Needs review
StatusFileSize
new24.71 KB

The Test Case EntityResourceTest has been removed and tested accordingly. Kindly review and suggest changes if any.

wim leers’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +API-First Initiative

Quoting myself from #3042745-41: Remove group @legacy from jsonapi tests and fix deprecation messages:

I would frankly prefer deleting \Drupal\Tests\jsonapi\Kernel\Controller\EntityResourceTest altogether over making this private service public. EntityResourceTest served a purpose originally, when it was added in #2726265: [BUGFIX] Add test coverage for EntityResource, Routes and ResourceManager (exactly three years ago tomorrow), but it doesn't anymore today. It is too coupled to internals. Our functional test coverage tests a vast superset of what this tests. So I say: just delete it if it gets in the way.

alexpott’s picture

Status: Reviewed & tested by the community » Needs review

@Wim Leers the thing is I can't find any other test coverage of \Drupal\jsonapi\Controller\EntityResource::getIndividual() - well maybe I can I guess \Drupal\Tests\jsonapi\Functional\ResourceTestBase::testGetIndividual() is but that's not easy for me to find. I would be good if someone who knows the Json test coverage can prove that:

  • testGetIndividual
  • testGetIndividualDenied
  • testGetCollection
  • testGetFilteredCollection
  • testGetSortedCollection
  • testGetPagedCollection
  • testGetEmptyCollection
  • testGetRelated
  • testGetRelationship
  • testCreateIndividual
  • testCreateIndividualWithMissingRequiredData
  • testCreateIndividualDuplicateError
  • testPatchIndividual
  • testDeleteIndividual
  • testAddToRelationshipData
  • testReplaceRelationshipData
  • testRemoveFromRelationshipData

Are all covered elsewhere.

wim leers’s picture

Title: Remove \Drupal\Tests\jsonapi\Kernel\Controller\EntityResourceTest » Remove 99% of \Drupal\Tests\jsonapi\Kernel\Controller\EntityResourceTest since it is a subset of the functional tests
Assigned: shreyal999 » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new19.3 KB

#3036285: Add a \JsonApiResource\Relationship object to carry relationship data, metadata and a link collection. is having to update quite a lot in EntityResourceTest. Just like in #3042745: Remove group @legacy from jsonapi tests and fix deprecation messages, its tight coupling is rearing its ugly consequences. So working on this again.


but that's not easy for me to find

This is definitely true. I should have done that from the start. Sorry about that.

I would be good if someone who knows the Json test coverage can prove that:

Did that below.

Based on this, retitled and rerolled. The rerolled patch keeps EntityResourceTest, but removes all methods except for the two that the above research has identified to not have a superset of test coverage in the functional tests.

larowlan’s picture

larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Committed 103d362 and pushed to 8.8.x. Thanks!

  • larowlan committed 103d362 on 8.8.x
    Issue #3060836 by Wim Leers, shreyal999, alexpott, bnjmnm: Remove 99% of...
wim leers’s picture

🥳

Status: Fixed » Closed (fixed)

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