Skip to content

Fix integration test errors on PHP 8.5#4033

Merged
acicovic merged 3 commits intodevelopfrom
fix/integration-test-errors-on-php-8-5
Mar 4, 2026
Merged

Fix integration test errors on PHP 8.5#4033
acicovic merged 3 commits intodevelopfrom
fix/integration-test-errors-on-php-8-5

Conversation

@acicovic
Copy link
Collaborator

@acicovic acicovic commented Mar 4, 2026

Description

With this PR, we're fixing integration test errors on PHP 8.5.

Motivation and context

Failing integration tests were inhibiting our workflow

How has this been tested?

Integration tests now pass on PHP 8.5.

Summary by CodeRabbit

  • Tests

    • Improved test utilities with centralized reflection helper methods for enhanced code consistency.
  • Refactor

    • Consolidated reflection property accessibility handling across test suite for better maintainability and reduced code duplication.

@acicovic acicovic self-assigned this Mar 4, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ecfd6a5a-06cb-42f3-b358-40b572d0b60b

📥 Commits

Reviewing files that changed from the base of the PR and between 6d3a9e1 and 533c19a.

📒 Files selected for processing (6)
  • tests/Integration/ContentHelper/ContentHelperPostListStatsTest.php
  • tests/Integration/HeadlineTestingScriptsTest.php
  • tests/Integration/Integrations/IntegrationsTest.php
  • tests/Integration/TestCase.php
  • tests/Traits/TestsReflection.php
  • tests/Unit/Integrations/IntegrationsTest.php

📝 Walkthrough

Walkthrough

This PR refactors test infrastructure by introducing a centralized make_accessible() helper method in the TestsReflection trait that conditionally handles PHP version differences for reflection accessibility. The helper replaces direct setAccessible(true) calls throughout the test suite. Additionally, HeadlineTestingScriptsTest is enhanced with dedicated assertion helper methods for validating one-line script presence using regex-based validation.

Changes

Cohort / File(s) Summary
Test Reflection Infrastructure
tests/Traits/TestsReflection.php
Adds new public static make_accessible() helper that conditionally calls setAccessible(true) for PHP versions below 8.1. Refactors all internal reflection calls (get_method, get_property, set_private_property, set_protected_property) to use the new helper.
Integration Tests
tests/Integration/ContentHelper/ContentHelperPostListStatsTest.php, tests/Integration/Integrations/IntegrationsTest.php, tests/Integration/TestCase.php
Replaces direct setAccessible(true) invocations with delegated calls to self::make_accessible() helper for PHP version compatibility handling.
Unit Tests
tests/Unit/Integrations/IntegrationsTest.php
Adds TestsReflection trait import and usage; replaces direct reflection accessibility calls with the centralized make_accessible() helper.
Headline Testing Enhancements
tests/Integration/HeadlineTestingScriptsTest.php
Removes static property holding script string; introduces two new private helper methods assert_one_line_script_in_output() and assert_one_line_script_not_in_output() that use regex lookaheads for robust script tag validation with optional attribute matching. Refactors existing assertions to use the new helpers.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

Maintenance

Suggested reviewers

  • alecgeatches
  • vaurdan
✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/integration-test-errors-on-php-8-5

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 PHPStan (2.1.39)

Invalid configuration:
Unexpected item 'parameters › type_coverage'.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@acicovic acicovic marked this pull request as ready for review March 4, 2026 12:38
@acicovic acicovic requested a review from a team as a code owner March 4, 2026 12:38
@acicovic acicovic merged commit 4f34453 into develop Mar 4, 2026
36 checks passed
@acicovic acicovic deleted the fix/integration-test-errors-on-php-8-5 branch March 4, 2026 12:40
@acicovic acicovic added this to the 3.22.1 milestone Mar 4, 2026
github-actions bot added a commit that referenced this pull request Mar 4, 2026
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.

1 participant