Skip to content

Fix. Code. Unit tests for #760 merging.#792

Merged
Glomberg merged 2 commits intodevfrom
Fix-Code-Unit-test-added-for-#760-target-VI
Apr 29, 2026
Merged

Fix. Code. Unit tests for #760 merging.#792
Glomberg merged 2 commits intodevfrom
Fix-Code-Unit-test-added-for-#760-target-VI

Conversation

@Glomberg
Copy link
Copy Markdown
Member

Glomberg and others added 2 commits April 29, 2026 18:14
* Upd. Settings. `Bot Detector` setting - bot-detector setting removed. (#760)

* Upd. Settings. `Bot Detector` setting - added constant.

* Upd. Settings. `Bot Detector` setting - setting to data migration added.

* Upd. Settings. `Bot Detector` setting - wrapper for bot-detector state checking added.

* Upd. Settings. `Bot Detector` setting - bot-detector state checking replaced by wrapper.

* Upd. Settings. `Bot Detector` setting - bot-detector setting removed.

* Upd. Settings. `Bot Detector` setting - actual state displayed in the `Summary`.

* Upd. Settings. `Bot Detector` setting - bot-detector state checking replaced by wrapper #2.

* Upd. Code. JS re-minified.

* Fix. Settings. Bot-Detector summary description fixed.

* Fix. Code. Unit tests fixed: `TestFluentForms`, `TestNinjaForms`.

* Fix. Code. Unit test added: `TestCleantalkSettings`.

* Fix. Code. Unit test added: `TestSummaryAndSupportRenderer`.

* Fix. Code. JS re-minified.

* Fix. Code. Unit tests for #760 added.

* Fix. CI/CD. GitHub action for testing added.

* Fix. Code. Unit tests fixed.

* Fix. Code. Unit tests for #760 added #2.

* Fix. Code. Unit test for `apbct__is_bot_detector_enabled` fixed.

* Fix. Code. Unit test for `apbct__is_bot_detector_enabled` fixed #2.

* Fix. Code. Github action fixed.

* Fix. Code. Unit test for `apbct__is_bot_detector_enabled` fixed #3.

* Fix. Code. Unit test `TestCleantalkSettings` fixed.

* Fix. Code. Unit test `TestCleantalkSettings` fixed #2.

* Fix. Code. Unit test `TestCleantalkPublic` added.

* Fix. Code. Unit test `TestCleantalkPublic` updated.

* Fix. Code. Unit test `TestCleantalkPublic` updated #2.

* Fix. Code. Unit tests `TestCtPublicFunctionsLocalize` and `TestCtPublicLocalize` added.
…ed-for-#760-target-VI

# Conflicts:
#	.github/workflows/tests.yml
#	lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php
#	tests/Inc/TestCleantalkSettings.php
Copilot AI review requested due to automatic review settings April 29, 2026 15:18
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 25.77%. Comparing base (e21b6d5) to head (ad848f5).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev     #792      +/-   ##
============================================
+ Coverage     24.44%   25.77%   +1.32%     
  Complexity     5591     5591              
============================================
  Files           264      264              
  Lines         24096    24076      -20     
============================================
+ Hits           5891     6206     +315     
+ Misses        18205    17870     -335     

☔ View full report in Codecov by Sentry.
📢 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.

@Glomberg Glomberg merged commit f70df83 into dev Apr 29, 2026
11 checks passed
@Glomberg Glomberg deleted the Fix-Code-Unit-test-added-for-#760-target-VI branch April 29, 2026 15:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds/updates PHPUnit coverage around the Bot Detector state migration and related public/localize behavior to support the merge work for #760.

Changes:

  • Added new unit tests for updater migration (data__bot_detector_enableddata['bot_detector_enabled']).
  • Added new unit tests for public init/footer/enqueue behaviors related to pixel and bot detector.
  • Added/updated tests validating localized payload keys and updated settings fields.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/Inc/TestCleantalkUpdater.php New test for apbct_update_to_6_76_0() migration behavior.
tests/Inc/TestCleantalkSettings.php Adds namespace, includes settings file in setup, and extends bot-detector-related settings assertions.
tests/Inc/TestCleantalkPublic.php New tests for pixel URL init behavior, footer pixel output, and bot-detector script enqueue.
tests/Inc/TestCleantalkCommon.php New tests for apbct__is_bot_detector_enabled() behavior (default/data/constant).
tests/ApbctWP/Localize/TestCtPublicLocalize.php New test ensuring localized data exposes bot_detector_enabled and not legacy key.
tests/ApbctWP/Localize/TestCtPublicFunctionsLocalize.php New test ensuring localized functions data exposes bot_detector_enabled and not legacy key.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +30 to +33
// Act
apbct_update_to_6_76_0();
$apbct_rebuilt = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats'));

apbct_init();

// Assert
$this->assertNull($apbct->pixel_url);
Comment on lines +8 to +28
protected function setUp(): void
{
parent::setUp();
global $apbct;
$apbct = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats'));
}

protected function tearDown(): void
{
global $apbct;
unset($apbct);
parent::tearDown();
}

public function testGetData()
{
// Arrange

// Act
$localize_data = CtPublicLocalize::getData();

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