Skip to content

test: add PhpStanPromptTransformer tests (3.6% → 100% coverage)#57

Open
jordanpartridge wants to merge 1 commit intomasterfrom
test/phpstan-prompt-transformer-coverage
Open

test: add PhpStanPromptTransformer tests (3.6% → 100% coverage)#57
jordanpartridge wants to merge 1 commit intomasterfrom
test/phpstan-prompt-transformer-coverage

Conversation

@jordanpartridge
Copy link
Contributor

Summary

  • Adds 53 Pest tests for PhpStanPromptTransformer covering all methods and branches
  • Tests all 16 FIX_DIRECTIONS identifier mappings, prefix fallback, and 5 message inference patterns
  • Covers JSON extraction from mixed output, error formatting edge cases, file sorting, and path relativization

Test plan

  • All 53 new tests pass
  • Full suite (256 tests) passes with no regressions
  • Pint formatting applied

Closes #44

53 tests covering all public and private methods: canHandle(),
transform(), parseJson(), buildPrompt(), formatError(),
getFixDirection(), inferFromMessage(), relativePath(), and
collectErrorTypes(). Tests all FIX_DIRECTIONS mappings, prefix
fallback, message inference patterns, JSON extraction from mixed
output, error formatting edge cases, and file sorting.

Closes #44
@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Warning

Rate limit exceeded

@jordanpartridge has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 8 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d77bec7b-f540-4bc2-880e-becab2c3b6b2

📥 Commits

Reviewing files that changed from the base of the PR and between 5691a60 and a1d6658.

📒 Files selected for processing (1)
  • tests/Unit/Transformers/PhpStanPromptTransformerTest.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/phpstan-prompt-transformer-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.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

📊 Coverage Report

Metric Coverage Threshold Status
Lines 75.3% 100%

Files Below Threshold

File Coverage Uncovered Lines
app/Commands/AnalyzeCommand.php 0% 22, 23, 25, 26, 28... (+51 more)
app/Commands/CheckCommand.php 0% 30, 31, 33, 34, 37... (+91 more)
app/Transformers/TestFailurePromptTransformer.php 11.7% 47, 68, 69, 71, 72... (+101 more)
app/Services/PromptAssembler.php 88.9% 55, 56, 57, 58, 120
app/GitHub/ChecksClient.php 89.1% 218, 219, 222, 223, 226... (+8 more)
app/Transformers/PhpStanPromptTransformer.php 98.8% 172

🏆 Synapse Sentinel Gate

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🔧 Synapse Sentinel: 2 checks need attention

The following issues must be resolved before this PR can be merged:


All tests passed.---

Security Audit


Review the output and fix any issues.

Quick Reference:

  • PHPStan errors → Fix type mismatches first, then missing types
  • Test failures → Read the assertion message, trace expected vs actual
  • Style issues → Run composer format to auto-fix

🤖 Generated by Synapse Sentinel - View Run

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.

Write PhpStanPromptTransformer tests (coverage: 3.6% → 100%)

1 participant