Skip to content

refactor: add Guzzle injection to AnalyzeCommand with full test coverage#59

Open
jordanpartridge wants to merge 1 commit intomasterfrom
refactor/analyze-command-testability
Open

refactor: add Guzzle injection to AnalyzeCommand with full test coverage#59
jordanpartridge wants to merge 1 commit intomasterfrom
refactor/analyze-command-testability

Conversation

@jordanpartridge
Copy link
Contributor

Summary

  • Refactored AnalyzeCommand to support Guzzle Client injection via withMocks() pattern, matching the established convention in SecurityCommand and CertifyCommand
  • Made class final for consistency with other commands
  • Added repoOverride and shaOverride to avoid shell_exec calls in tests
  • Created tests/Unit/Commands/AnalyzeCommandTest.php with 13 tests covering all code paths (0% → 100% coverage)

Test plan

  • All 13 new AnalyzeCommand tests pass
  • Full test suite (216 tests) passes with no regressions
  • Pint formatting verified

Closes #48

Add withMocks() pattern for dependency injection of HTTP client, repo,
and SHA - matching the established pattern in SecurityCommand and
CertifyCommand. Add 13 tests covering all code paths.

Closes #48
@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 20 minutes and 3 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: 396c17ee-e05b-47cb-b4ba-465d360f0688

📥 Commits

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

📒 Files selected for processing (2)
  • app/Commands/AnalyzeCommand.php
  • tests/Unit/Commands/AnalyzeCommandTest.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/analyze-command-testability

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 72.8% 100%

Files Below Threshold

File Coverage Uncovered Lines
app/Commands/CheckCommand.php 0% 30, 31, 33, 34, 37... (+91 more)
app/Transformers/PhpStanPromptTransformer.php 3.6% 49, 51, 52, 53, 54... (+76 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/Commands/AnalyzeCommand.php 89.1% 56, 58, 116, 117, 118... (+2 more)
app/GitHub/ChecksClient.php 89.1% 218, 219, 222, 223, 226... (+8 more)

🏆 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.

Refactor and test AnalyzeCommand (coverage: 0% → 100%)

1 participant