Skip to content

Udp.Code.Unit tests - #885

Open
alexander-b-clean wants to merge 2 commits into
devfrom
delay-unit-test.ab
Open

Udp.Code.Unit tests#885
alexander-b-clean wants to merge 2 commits into
devfrom
delay-unit-test.ab

Conversation

@alexander-b-clean

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The refactor is small, preserves prior behavior, and the added tests cover the new helper and its integration point in perform().

Pull request overview

This PR refactors remote-call delay handling in RemoteCalls::perform() by extracting the delay/whitelist/capping logic into a dedicated private helper, and expands unit test coverage to validate the helper’s behavior and the delegation wiring.

Changes:

  • Added RemoteCalls::getDelayForAction() to centralize delay permission, normalization, and capping to MAX_DELAY.
  • Updated RemoteCalls::perform() to delegate delay decisions to getDelayForAction() and branch on null vs non-null.
  • Added comprehensive unit tests covering whitelist behavior, case-insensitivity, empty/invalid delay handling, min/max bounds, and ensuring perform() delegates delay decisions.
File summaries
File Description
tests/ApbctWP/TestRemoteCalls.php Adds unit tests for delay decision logic and asserts perform() delegates delay handling to the new helper.
lib/Cleantalk/ApbctWP/RemoteCalls.php Introduces getDelayForAction() and refactors perform() to use it for delay gating and capping.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.60%. Comparing base (bd22469) to head (44a56a1).
⚠️ Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
lib/Cleantalk/ApbctWP/RemoteCalls.php 70.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev     #885      +/-   ##
============================================
+ Coverage     30.47%   30.60%   +0.12%     
- Complexity     6627     6637      +10     
============================================
  Files           292      292              
  Lines         26432    26448      +16     
============================================
+ Hits           8056     8094      +38     
+ Misses        18376    18354      -22     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants