Skip to content

[#756] Made accessibility console summary opt-in via 'BEHAT_ACCESSIBILITY_PRINT'. - #757

Merged
AlexSkrypnyk merged 1 commit into
mainfrom
feature/756-a11y-print-optin
Aug 19, 2026
Merged

[#756] Made accessibility console summary opt-in via 'BEHAT_ACCESSIBILITY_PRINT'.#757
AlexSkrypnyk merged 1 commit into
mainfrom
feature/756-a11y-print-optin

Conversation

@AlexSkrypnyk

Copy link
Copy Markdown
Member

Closes #756

Summary

AccessibilityTrait used to unconditionally fwrite(STDOUT, ...) a one-line per-page summary every time a page was assessed, so any consumer's console output was cluttered with [accessibility] <url>: N violations, ... lines it never asked for. Console printing is now opt-in: a new protected getter, accessibilityGetPrintCli(), guards the fwrite call, and its default implementation returns TRUE only when the BEHAT_ACCESSIBILITY_PRINT environment variable is set to a non-empty value other than 0. Consumers can also override the getter to hardcode either behaviour. HTML, JUnit, and aggregate reports are unaffected; only the STDOUT line is gated.

Changes

  • src/AccessibilityTrait.php: Added the protected accessibilityGetPrintCli() getter, wrapped the existing fwrite(STDOUT, ...) summary in a call to it, and extended the trait docblock with a new "Console output" section documenting the opt-in behaviour and the BEHAT_ACCESSIBILITY_PRINT environment variable.
  • tests/behat/features/accessibility.feature: Added two Behat-in-Behat @trait:AccessibilityTrait scenarios covering the default-silent path and the BEHAT_ACCESSIBILITY_PRINT-enabled path.
  • STEPS.md: Regenerated from the updated trait docblock so the new "Console output" section is reflected in the published documentation.

Before / After

BEFORE                                    AFTER
──────                                    ─────
Page assessed                             Page assessed
      │                                         │
      ▼                                         ▼
fwrite(STDOUT, ...)                       accessibilityGetPrintCli()
      │                                         │
      ▼                                   ┌─────┴─────┐
"[accessibility] <url>:                   │           │
 N violations, N passes,                FALSE        TRUE
 N incomplete (rules: ...)"          (default:    (BEHAT_ACCESSIBILITY_PRINT
                                     env unset      set to a non-empty,
Printed on every run,                or "0")        non-"0" value)
regardless of consumer need              │           │
                                          ▼           ▼
                                    No STDOUT    fwrite(STDOUT, ...)
                                     output      "[accessibility] <url>:
                                                   N violations, ..."

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your current included review allowance is based on your included PR review attempts over the past 7 days.

Next review available in: 37 minutes

Limit details: You’ve used all 2 included reviews currently available. Your 82 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

You’re in a promotional period — use the checkbox below to run this review for free:

  • Run review for free

On-demand reviews are free for the next 30 days. After that, they cost $0.25 per reviewed file.

How can I continue?

Run this review now using the option above, or comment @coderabbitai review --use-credits.

You can also wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 28184493-12e5-4583-a30f-6066083f6845

📥 Commits

Reviewing files that changed from the base of the PR and between 7224e7a and 8208061.

📒 Files selected for processing (3)
  • STEPS.md
  • src/AccessibilityTrait.php
  • tests/behat/features/accessibility.feature

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

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.40%. Comparing base (7224e7a) to head (8208061).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #757   +/-   ##
=======================================
  Coverage   97.40%   97.40%           
=======================================
  Files          52       52           
  Lines        4552     4555    +3     
=======================================
+ Hits         4434     4437    +3     
  Misses        118      118           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AlexSkrypnyk AlexSkrypnyk added the Needs review Pull request needs a review from assigned developers label Aug 19, 2026
@AlexSkrypnyk
AlexSkrypnyk merged commit a4517e3 into main Aug 19, 2026
19 checks passed
@AlexSkrypnyk
AlexSkrypnyk deleted the feature/756-a11y-print-optin branch August 19, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs review Pull request needs a review from assigned developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to opt-in into accessibility to print into CLI

1 participant