Merged
Conversation
* 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
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
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_enabled→data['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(); | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://app.doboard.com/1/task/48051