Skip to content

Add test coverage for get_code_length() and autosubmit filters#821

Merged
georgestephanis merged 2 commits intoalternative/pr-741-autosubmit-tweakfrom
copilot/sub-pr-820
Mar 4, 2026
Merged

Add test coverage for get_code_length() and autosubmit filters#821
georgestephanis merged 2 commits intoalternative/pr-741-autosubmit-tweakfrom
copilot/sub-pr-820

Conversation

Copy link

Copilot AI commented Mar 4, 2026

The new get_code_length() static method, two_factor_code_length filter, and two_factor_autosubmit_length filter introduced in #820 had no test coverage.

Changes

tests/providers/class-two-factor-provider.php

  • test_get_code_length_returns_defaultget_code_length() returns its $default argument when no filter is hooked
  • test_get_code_length_filter_overrides_defaulttwo_factor_code_length filter overrides the default
  • test_get_code_with_null_uses_filtered_lengthget_code(null) delegates to get_code_length(), picking up the filtered value

tests/providers/class-two-factor-backup-codes.php

  • test_autosubmit_length_filter_affects_authentication_pagetwo_factor_autosubmit_length filter changes the data-digits attribute in the rendered authentication page HTML; also covers the __return_zero disable-autosubmit use case documented in the readme
add_filter( 'two_factor_autosubmit_length', '__return_zero' );
// authentication_page() now renders: data-digits="0"

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…gth filter

Co-authored-by: georgestephanis <941023+georgestephanis@users.noreply.github.com>
Copy link
Author

Copilot AI commented Mar 4, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/2b1d206d81b74ed999023cffd924f862ff2753c8
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/wQ6tWy /usr/bin/composer install (http block)
  • https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/b598aa890815b8df16363271b659d73280129101
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/wQ6tWy /usr/bin/composer install (http block)
  • https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/c216317e96c8b3f5932808f9b0f1f7a14e3bbf55
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/wQ6tWy /usr/bin/composer install (http block)
  • https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0ca86845ce43291e8f5692c7356fccf3bcf02bf4
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/wQ6tWy /usr/bin/composer install (http block)
  • https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/845eb62303d2ca9b289ef216356568ccc075ffd1
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/wQ6tWy /usr/bin/composer install (http block)
  • https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7795ec6fa05663d716a549d0b44e47ffc8b0d4a6
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/wQ6tWy /usr/bin/composer install (http block)
  • https://api.github.com/repos/reactphp/event-loop/zipball/ba276bda6083df7e0050fd9b33f66ad7a4ac747a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/wQ6tWy /usr/bin/composer install (http block)
  • https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/a15e970b8a0bf64cfa5e86d941f5e6b08855f369
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/wQ6tWy /usr/bin/composer install (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] WIP for addressing feedback on PR 820 Add test coverage for get_code_length() and autosubmit filters Mar 4, 2026
@georgestephanis georgestephanis marked this pull request as ready for review March 4, 2026 16:02
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @Copilot.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: Copilot.


To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@georgestephanis georgestephanis merged commit 18732c9 into alternative/pr-741-autosubmit-tweak Mar 4, 2026
56 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.

2 participants