Add tests for EntityFieldFetchItem

Created on 5 January 2024, over 1 year ago

Problem/Motivation

This module doesn't have any tests yet. It would be good to start somewhere and keep adding more tests as time goes. Since a recent issue is updating code for the EntityFieldFetchItem class, I thought it would be a good idea to add one or more tests around that functionality.

Proposed resolution

Add tests for:

1. Field definitions, default values, config.
2. Field functionality, mainly the fetching aspect...but that would mock the Fetcher service so probably test that service too.

I will likely update this issue description once I know more about what I'm doing, but creating the field and making some assertions should get me on the right track.

I also think adding the default testing config will kick off some linters, and they might have errors in the output that can be turned into issues.

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States afinnarn

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

Comments & Activities

  • Issue created by @afinnarn
  • πŸ‡ΊπŸ‡ΈUnited States afinnarn

    Turns out that most core field types I've looked at don't provide unit tests, but rather they test at a higher integration level using KernelTestBase.

    I am looking at how the LinkItem and PathItem classes are tested, and I think this will turn into tests where you create a content type, add the field, save a node with the field filled in...blah blah. I, of course, need to create an entity to fetch data off of first, but at least kernel tests don't usually have you mocking anything. I still get caught up with mocking/stubbing/spying and all that jazz.

Production build 0.71.5 2024