Problem/Motivation

The Country module currently has minimal test coverage with only 2 functional tests in a single test file. This limited coverage makes it difficult to:
- Detect regressions when making changes
- Verify that all components work correctly
- Maintain code quality and stability
- Ensure compatibility with new Drupal core versions

The module's core functionality including field types, formatters, widgets, Views integration, and the CountryFieldManager service lack automated test coverage.

Proposed resolution

Add comprehensive PHPUnit test coverage for the Country module's core components:
- CountryFieldManager service: Test country list retrieval and selectable countries with restrictions
- CountryItem field type: Test isEmpty(), validation constraints, and options providers
- Field formatters: Test CountryDefaultFormatter and CountryCodeFormatter output
- Field widgets: Test CountryDefaultWidget and CountryAutocompleteWidget rendering and validation
- Views integration: Test filter and sort plugins
- Autocomplete controller: Test search functionality and JSON responses

Use kernel tests for services and plugins (fast execution), and functional tests only where browser interaction is required.

CommentFileSizeAuthor
#4 PassedTests.png280.41 KBimmoreel

Issue fork country-3564737

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

batigolix created an issue. See original summary.

batigolix’s picture

Assigned: batigolix » Unassigned
Status: Active » Needs review
immoreel’s picture

StatusFileSize
new280.41 KB

Works as advertised, all tests pass, see https://git.drupalcode.org/project/country/-/pipelines/696826
Test result page

immoreel’s picture

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

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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