Skip to content

GH#710: fix(paypal-rest): use $title param in get_checkout_label_html and assert it in test#711

Merged
superdav42 merged 1 commit intomainfrom
fix/quality-debt-paypal-test-710
Mar 31, 2026
Merged

GH#710: fix(paypal-rest): use $title param in get_checkout_label_html and assert it in test#711
superdav42 merged 1 commit intomainfrom
fix/quality-debt-paypal-test-710

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

Summary

  • get_checkout_label_html() was ignoring its $title argument and always rendering the hardcoded 'PayPal' string via esc_html__(). Changed to esc_html($title) so the caller-supplied label is rendered in the checkout option span.
  • test_get_checkout_label_html_includes_title now asserts both 'Custom Title' (the passed argument) and 'PayPal' (the logo alt text), fixing the intent/expectation mismatch flagged by CodeRabbit in PR t458: test(paypal-rest): expand PayPal_REST_Gateway test coverage toward ≥80% #636.

Files changed (2)

  • inc/gateways/class-paypal-rest-gateway.php — use $title in sprintf instead of hardcoded i18n string
  • tests/WP_Ultimo/Gateways/PayPal_REST_Gateway_Test.php — add assertStringContainsString('Custom Title', $html) assertion

Risk

Low — test-only assertion change plus a one-line fix in a rendering helper. No business logic altered.

Closes #710


aidevops.sh v3.5.466 plugin for OpenCode v1.3.0 with claude-sonnet-4-6 spent 2m and 5,266 tokens on this as a headless worker.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

Warning

Rate limit exceeded

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

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 8 minutes and 44 seconds.

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 14253636-6ab5-488a-9812-d7f02bb1d354

📥 Commits

Reviewing files that changed from the base of the PR and between c0aa6fe and 2e33513.

📒 Files selected for processing (2)
  • inc/gateways/class-paypal-rest-gateway.php
  • tests/WP_Ultimo/Gateways/PayPal_REST_Gateway_Test.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/quality-debt-paypal-test-710

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
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

Performance Test Results

Performance test results for dedda38 are in 🛎️!

Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown.

URL: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 40 (-1 / -3% ) 37.78 MB 895.50 ms (+38.50 ms / +4% ) 163.00 ms (-3.50 ms / -2% ) 1094.00 ms (+64.50 ms / +6% ) 2046.00 ms (+52.00 ms / +3% ) 1962.50 ms (+53.90 ms / +3% ) 86.35 ms
1 56 49.01 MB 926.00 ms 143.50 ms 1071.00 ms 2054.00 ms (+50.00 ms / +2% ) 1973.00 ms (+49.80 ms / +3% ) 81.65 ms

…ert it in test

The implementation was ignoring the $title argument and always rendering
the hardcoded 'PayPal' string via esc_html__(). Switch to esc_html($title)
so the caller-supplied label is rendered in the checkout option span.

Update test_get_checkout_label_html_includes_title to assert both the
custom title and the PayPal logo alt text, fixing the intent/expectation
mismatch flagged by CodeRabbit in PR #636.

Closes #710
@superdav42 superdav42 force-pushed the fix/quality-debt-paypal-test-710 branch from a1a5388 to 2e33513 Compare March 31, 2026 02:14
@github-actions
Copy link
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42 superdav42 merged commit 3af4683 into main Mar 31, 2026
11 checks passed
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.

quality-debt: tests/WP_Ultimo/Gateways/PayPal_REST_Gateway_Test.php — PR #636 review feedback (medium)

1 participant