Skip to content

Conversation

@martin-georgiev
Copy link
Owner

@martin-georgiev martin-georgiev commented Apr 22, 2025

Summary by CodeRabbit

  • Chores
    • Updated testing workflow to use a different code coverage driver for improved performance.
    • Enhanced test output with more detailed verbosity and error reporting options.
    • Introduced new test scripts and a command-line tool to run tests individually per file with optional coverage reporting.
    • Removed specific test cases and a test class related to query function validation and exception handling.

@coderabbitai
Copy link

coderabbitai bot commented Apr 22, 2025

Walkthrough

The changes update the project's continuous integration (CI) workflow and Composer configuration related to PHPUnit test execution and code coverage. The CI workflow switches the PHP code coverage driver from "xdebug" to "pcov" and modifies the test step to run PHPUnit tests individually per test file instead of all at once. The composer.json is updated to remove the XDEBUG_MODE=coverage environment variable from the PHPUnit script and add new options for enhanced test output. Additionally, new scripts are introduced to run tests split by individual files, supported by a new Bash script that handles per-file test execution and optional coverage reporting. In the test suite, a specific test method checking exception behavior in a base variadic function test case is removed, and a whole test class for the RegexpInstr function is deleted.

Changes

File(s) Change Summary
.github/workflows/ci.yml Changed PHP code coverage driver from "xdebug" to "pcov"; modified test step to run PHPUnit tests individually per test file with coverage.
composer.json Removed XDEBUG_MODE=coverage from phpunit script; added --testdox, --display-deprecations, --display-errors, and --display-incomplete options; added new scripts run-tests-split and run-tests-split-with-clover to run tests split by file.
ci/phpunit/run-split-tests.sh Added new Bash script to run PHPUnit tests individually per test file with optional per-file coverage reporting; outputs progress and handles missing directories gracefully.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunctionTestCase.php Removed a test method that checked exception throwing for an unpopulated lexer lookahead in the base variadic function test case.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php Deleted entire test class covering the RegexpInstr function, including tests for argument validation and SQL generation.

Possibly related PRs

Poem

In the warren where the tests all run,
The coverage driver swap is done.
From xdebug’s warren to pcov’s den,
The scripts are clearer, time to hop again!
With tests split fine and coverage neat,
This rabbit’s code is hard to beat.
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 24c34b7 and b085daa.

📒 Files selected for processing (2)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunctionTestCase.php (0 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php (0 hunks)
💤 Files with no reviewable changes (2)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunctionTestCase.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: PHP 8.4 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer latest
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.18 + Doctrine Lexer latest
  • GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.3 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer latest
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.14 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer latest
  • GitHub Check: PHP 8.1 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.14 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.1 + Doctrine ORM 3.0 + Doctrine Lexer latest
  • GitHub Check: PHP 8.1 + Doctrine ORM latest + Doctrine Lexer latest
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.14 + Doctrine Lexer 2.1

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
composer.json (1)

74-74: Approve removal of explicit XDEBUG_MODE env var. This change aligns the PHPUnit script with the new PCOV-based coverage in CI. Consider updating your developer documentation (e.g., README or CONTRIBUTING) with instructions to enable PCOV locally (for example, pecl install pcov && echo "pcov.enabled=1" >> php.ini).

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f3aff7 and 739d526.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml (1 hunks)
  • composer.json (1 hunks)
🔇 Additional comments (1)
.github/workflows/ci.yml (1)

65-65: Switching the coverage driver to PCOV. Leveraging PCOV can significantly speed up coverage reporting. Please verify that the pinned shivammathur/setup-php action commit supports PCOV for all PHP versions in your matrix and that the PCOV extension is actually loaded during CI runs.

coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 22, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 22, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 22, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
ci/phpunit/run-split-tests.sh (2)

38-38: Split declaration and assignment for coverage_file to avoid masking return values
Shellcheck SC2155 suggests declaring and assigning separately when using command substitution.

Proposed diff:

- local coverage_file="split/$(basename "$test_file" .php).xml"
+ local coverage_file
+ coverage_file="split/$(basename "$test_file" .php).xml"
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 38-38: Declare and assign separately to avoid masking return values.

(SC2155)


9-13: Consider making TEST_DIRS configurable via args or env
Currently test directories are hard‑coded for a single namespace. Allowing an environment variable or CLI option (e.g., --dirs) would make the script reusable across different projects or directory layouts.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34eb11b and 24c34b7.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml (2 hunks)
  • ci/phpunit/run-split-tests.sh (1 hunks)
  • composer.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • composer.json
🧰 Additional context used
🪛 Shellcheck (0.10.0)
ci/phpunit/run-split-tests.sh

[error] 17-17: Arrays implicitly concatenate in [[ ]]. Use a loop (or explicit * instead of @).

(SC2199)


[warning] 38-38: Declare and assign separately to avoid masking return values.

(SC2155)

🪛 actionlint (1.7.4)
.github/workflows/ci.yml

116-116: shellcheck reported issue in this script: SC2044:warning:1:13: For loops over find output are fragile. Use find -exec or a while read loop

(shellcheck)

⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer latest
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.14 + Doctrine Lexer latest
  • GitHub Check: PHP 8.3 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.14 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.14 + Doctrine Lexer latest
  • GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.1 + Doctrine ORM 3.0 + Doctrine Lexer latest
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.14 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.18 + Doctrine Lexer latest
  • GitHub Check: PHP 8.1 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.1 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.1 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: sloth
🔇 Additional comments (3)
ci/phpunit/run-split-tests.sh (2)

54-56: Good use of find -print0 with read -r -d ''
This pattern safely handles file names with spaces or special characters, avoiding the pitfalls of simple for file in $(find ...) loops.


62-73: Coverage merging placeholder clearly documents future enhancement
Noting that a tool like phpcov is required and guiding users toward installation is valuable. When ready, integrating an automated merge command will complete this workflow.

.github/workflows/ci.yml (1)

63-67:

❓ Verification inconclusive

Switched PHPUnit coverage driver to pcov
Using PCOV offers faster, more efficient coverage reporting compared to Xdebug, especially for per-file runs. Please verify that the shivammathur/setup-php action correctly enables PCOV and that your ci/phpunit/config.xml has no lingering Xdebug references.

To confirm, run:


🏁 Script executed:

#!/bin/bash
grep -R "xdebug" ci/phpunit/config.xml || echo "No xdebug references found"

Length of output: 101


Confirm PCOV Coverage Setup
I’ve verified that ci/phpunit/config.xml contains no lingering Xdebug references. Next, please ensure that the shivammathur/setup-php action’s coverage: pcov option actually installs and enables the PCOV extension in your CI environment (e.g. check the job logs for “pcov” or add a step to run php -m).

Comment on lines +17 to +19
if [[ "$@" == *"--coverage-clover"* ]]; then
COVERAGE_ARGS="--coverage-clover=./var/logs/test-coverage/clover.xml"
fi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Replace wildcard comparison on "$@" with explicit loop to parse flags
Shellcheck SC2199 warns about using [[ "$@" == *"--coverage-clover"* ]]. Instead of relying on wildcard matching over the entire argument string, iterate through the arguments to detect the coverage flag safely.

Proposed diff:

- if [[ "$@" == *"--coverage-clover"* ]]; then
-   COVERAGE_ARGS="--coverage-clover=./var/logs/test-coverage/clover.xml"
- fi
+ COVERAGE_ARGS=""
+ for arg in "$@"; do
+   if [ "$arg" = "--coverage-clover" ]; then
+     COVERAGE_ARGS="--coverage-clover=./var/logs/test-coverage/clover.xml"
+     break
+   fi
+ done
🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 17-17: Arrays implicitly concatenate in [[ ]]. Use a loop (or explicit * instead of @).

(SC2199)

Comment on lines +116 to +120
run: |
for file in $(find tests -name "*Test.php"); do
echo "Running tests from $file"
php ./bin/phpunit --configuration=./ci/phpunit/config.xml "$file"
done
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Replace inline test loop with the centralized split-tests script
Duplicating loop logic here risks drift over time. Invoke the shared run-split-tests.sh script to ensure consistency between local and CI environments, and automatically handle coverage flags.

Proposed diff:

-      - name: Run test suite
-        run: |
-          for file in $(find tests -name "*Test.php"); do
-            echo "Running tests from $file"
-            php ./bin/phpunit --configuration=./ci/phpunit/config.xml "$file"
-          done
+      - name: Run split test suite (no coverage)
+        if: matrix.calculate-code-coverage != 'true'
+        run: bash ci/phpunit/run-split-tests.sh
+
+      - name: Run split test suite (with coverage)
+        if: matrix.calculate-code-coverage == 'true'
+        run: bash ci/phpunit/run-split-tests.sh --coverage-clover
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run: |
for file in $(find tests -name "*Test.php"); do
echo "Running tests from $file"
php ./bin/phpunit --configuration=./ci/phpunit/config.xml "$file"
done
- name: Run split test suite (no coverage)
if: matrix.calculate-code-coverage != 'true'
run: bash ci/phpunit/run-split-tests.sh
- name: Run split test suite (with coverage)
if: matrix.calculate-code-coverage == 'true'
run: bash ci/phpunit/run-split-tests.sh --coverage-clover
🧰 Tools
🪛 actionlint (1.7.4)

116-116: shellcheck reported issue in this script: SC2044:warning:1:13: For loops over find output are fragile. Use find -exec or a while read loop

(shellcheck)

@martin-georgiev martin-georgiev deleted the bye-xdebug branch April 22, 2025 18:16
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