Conversation
- Create SectionPattern helper class following existing helper pattern - Uses configured pattern_directory with fallback to /src/assets/background-patterns/ - Applies SVG escaping via Helper::EscapeSVG()
- Add CSS variables for reusable button padding at root level - Restructure buttons.scss with clear sections and documentation - Add fill (default) and outline appearance variants - Implement hover states with color reversals for all button styles - Update outline buttons to use currentColor for text with styled borders - Maintain existing icon sizing with improved CSS variable naming
- Update SectionPattern::render() to handle patternAlign attribute - Add alignment mapping for all 9 positions - Output classes in pattern-align--x-x format for CSS targeting
- Add PHPUnit test configuration - Set up test bootstrap with WP_Mock support
- Test matrix for PHP 8.1, 8.2, 8.3, 8.4 - PHPUnit tests with code coverage - PHPCS coding standards validation - PHP compatibility checks - Security vulnerability scanning - Codecov integration for coverage reports - Manual workflow dispatch support
- Remove version field from composer.json (use git tags instead) - Update release workflow to skip composer version bumps - Follow Composer best practices for version management - Prevents constant merge conflicts between branches
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive testing infrastructure and development tooling to the WP Utility library. It establishes a PHPUnit test suite with WordPress mocking capabilities, sets up automated testing workflows, and includes various test files for the library's components.
Key Changes:
- Established PHPUnit testing framework with WP_Mock for WordPress function mocking
- Added GitHub Actions workflows for automated testing and release management
- Created comprehensive test coverage for utility classes, helpers, and components
- Updated development dependencies and build configuration
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/bootstrap.php | PHPUnit bootstrap with WordPress mocking setup |
| tests/WPMockTestCase.php | Base test case class for WP_Mock functionality |
| tests/Unit/*.php | Unit tests for main utility classes |
| tests/Unit/Utilities/ReadingTimeTest.php | Tests for ReadingTime utility functionality |
| phpunit.xml | PHPUnit configuration with test suites and coverage |
| phpcs.xml | PHP CodeSniffer configuration for coding standards |
| .github/workflows/*.yml | CI/CD workflows for testing and releases |
| composer.json | Updated dependencies and scripts for development |
| inc/Helpers/SectionPattern.php | New helper for rendering section patterns |
| inc/Components/*.php | Updates to Button and Image components |
| namespace BuiltNorth\WPUtility\Helpers; | ||
|
|
||
| use BuiltNorth\WPUtility\Helper; | ||
|
|
There was a problem hiding this comment.
The SectionPattern class is missing a class-level docblock that describes its purpose and functionality. Add a docblock with @Package and description of what this class does.
| /** | |
| * Provides functionality to render section patterns using SVG files from the theme. | |
| * Handles pattern configuration, alignment, and SVG retrieval for use in block rendering. | |
| * | |
| * @package BuiltNorth\WPUtility\Helpers | |
| */ |
| // Temporarily switch to parent theme context | ||
| add_filter('stylesheet', function() { return get_template(); }, 999); | ||
| $pattern_config = $feature_manager->get_feature(['editor_experience', 'patterns'], []); | ||
| remove_filter('stylesheet', function() { return get_template(); }, 999); |
There was a problem hiding this comment.
The anonymous function used in add_filter cannot be properly removed by the corresponding remove_filter call on line 39, since remove_filter requires the exact same function reference. Store the function in a variable or use a named function to ensure proper cleanup.
| remove_filter('stylesheet', function() { return get_template(); }, 999); | |
| $parent_stylesheet_filter = function() { return get_template(); }; | |
| add_filter('stylesheet', $parent_stylesheet_filter, 999); | |
| $pattern_config = $feature_manager->get_feature(['editor_experience', 'patterns'], []); | |
| remove_filter('stylesheet', $parent_stylesheet_filter, 999); |
| "dealerdirect/phpcodesniffer-composer-installer": true | ||
| } | ||
| }, | ||
| "minimum-stability": "dev", |
There was a problem hiding this comment.
Setting minimum-stability to 'dev' can introduce unstable dependencies into the project. Consider using 'stable' instead, or if dev packages are needed, specify them individually with stability flags (e.g., 'package/name:dev-main').
| "minimum-stability": "dev", |
No description provided.