Skip to content

Conversation

colinmurphy
Copy link
Member

@colinmurphy colinmurphy commented Sep 26, 2025

Description

This pull request introduces several improvements and refactors to the WPGraphQL Logging plugin's settings infrastructure, focusing on standardizing tab interfaces, improving configuration access, and simplifying code. The changes enhance maintainability and testability, and bring coverage above 90%.

Settings Tab Interface and Usage Standardization:

  • Refactored SettingsTabInterface to require static get_name() and get_label() methods, and updated all tab classes (BasicConfigurationTab, DataManagementTab) and their usages to use these static methods instead of instance methods. This ensures consistent tab identification and labeling across the codebase. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

Configuration Helper Improvements:

  • Updated ConfigurationHelper methods to use static tab names and labels, improving reliability and reducing hardcoded strings. Added a new get_option_value() method for more direct option retrieval, and removed the unused reload_config() method. [1] [2] [3] [4] [5] [6] [7]

Codebase Simplification and Cleanup:

  • Removed the now-redundant LoggingSettingsService class, consolidating configuration access through ConfigurationHelper.
  • Updated SettingsFormManager to accept a ConfigurationHelper instance in its constructor for improved dependency injection and testability. [1] [2]

Field and Input Handling:

  • Simplified the TextInputField::sanitize_field() method to always use sanitize_text_field, removing special handling for email and URL input types.
  • Updated field construction in tab classes to use static tab names, further supporting the interface refactor. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Other Notable Changes:

  • Minor documentation and example cleanups, and a correction to a placeholder example in the UI.
  • Added and updated PHPUnit tests, raising coverage above 90%. (.changeset/eight-moons-help.md)

These changes collectively make the settings architecture more robust, easier to extend, and better covered by tests.

Related Issue

#412

Dependant PRs

Type of Change

  • ✅ Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactoring (no functional changes)
  • 📄 Example update (no functional changes)
  • 📝 Documentation update
  • 🔍 Performance improvement
  • 🧪 Test update

How Has This Been Tested?

Screenshots

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the project's coding standards
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • Any dependent changes have been highlighted, merged or published

Refactored SettingsPage to use a getter for the field collection and improved template path handling. Removed special email and URL sanitization from TextInputField, now using only sanitize_text_field. Added new and expanded unit tests for SettingsFieldCollection, MenuPage, TextIntegerField, and improved test coverage and docblocks for existing field and settings page tests. Renamed Settings_Page_Test.php to SettingsPageTest.php for consistency.
Copy link

changeset-bot bot commented Sep 26, 2025

🦋 Changeset detected

Latest commit: ef373fa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@wpengine/wpgraphql-logging-wordpress-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

github-actions bot commented Sep 26, 2025

📦 Plugin Artifacts Ready!

Download from GitHub Actions run

Available plugins:

  • ✅ wpgraphql-logging.zip

See the "Artifacts" section at the bottom of the Actions run page

@colinmurphy colinmurphy changed the title chore: DRAFT - WPGraphQL Logging Snags chore: WPGraphQL Logging Snags & Automated Tests Oct 1, 2025
@colinmurphy colinmurphy marked this pull request as ready for review October 1, 2025 08:47
@colinmurphy colinmurphy requested a review from a team as a code owner October 1, 2025 08:47
@colinmurphy colinmurphy enabled auto-merge October 1, 2025 08:48
@colinmurphy colinmurphy requested a review from theodesp October 1, 2025 08:55
@colinmurphy colinmurphy added this pull request to the merge queue Oct 1, 2025
Merged via the queue into main with commit 65b531b Oct 1, 2025
22 checks passed
@colinmurphy colinmurphy deleted the chore-wpgraphql-snags-sept-2025-iteration-2 branch October 1, 2025 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants