Skip to content

Add comprehensive unit tests for ProductSets Delete Response class#3398

Closed
sol-loup wants to merge 2 commits intomainfrom
test/add-productsets-delete-response-coverage
Closed

Add comprehensive unit tests for ProductSets Delete Response class#3398
sol-loup wants to merge 2 commits intomainfrom
test/add-productsets-delete-response-coverage

Conversation

@sol-loup
Copy link
Copy Markdown
Contributor

Description

This PR adds comprehensive unit test coverage for the ProductCatalog\ProductSets\Delete\Response class, which handles Facebook Product Sets deletion API responses.

Type of change

  • Add (non-breaking change which adds functionality)

Checklist

  • I have commented my code, particularly in hard-to-understand areas, if any.
  • I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
  • I have checked plugin debug logs that my changes do not introduce any new PHP warnings or FATAL errors.
  • I followed general Pull Request best practices.
  • I have added tests (if necessary) and all the new and existing unit tests pass locally with my changes.
  • I have completed dogfooding and QA testing, or I have conducted thorough due diligence to ensure that it does not break existing functionality.
  • I have updated or requested update to plugin documentations (if necessary).

Changelog entry

Add comprehensive unit tests for ProductSets Delete Response class to improve code coverage

Test Plan

  1. Run the unit tests with: composer test-unit -- tests/Unit/API/ProductCatalog/ProductSets/Delete/ProductSetsDeleteResponseTest.php
  2. All 16 tests should pass successfully (49 assertions)
  3. The tests cover:
    • Class structure: Existence, instantiation, and inheritance verification
    • Success property: Testing boolean success values for true/false scenarios
    • Error handling: API error detection, permission errors, and error subcodes
    • Data handling: Array access interface, empty responses, null values
    • Edge cases: String boolean values ("true"), numeric success values (1), partial deletion scenarios
    • Additional fields: Deletion metadata, timestamps, error messages

Screenshots

Not applicable - this PR only adds unit tests

- Test class existence and instantiation

- Test inheritance from API Response and JSONResponse

- Test success property for true/false values

- Test error handling and API error methods

- Test array access interface functionality

- Test edge cases: empty JSON, null values, string/numeric booleans

- Test partial deletion scenarios and permission errors

These tests improve code coverage for the previously untested ProductSets Delete API Response class.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 16, 2025

📦 Latest Plugin Build

Built at: 2025-06-16T19:56:20.380Z
Commit: 97fd188
Size: 1.1M

Download: Click here to download the plugin

To download: Click the link above → Scroll to bottom → Download "facebook-for-woocommerce" artifact

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@sol-loup has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@sol-loup has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@sol-loup merged this pull request in 1d1deb4.

@vahidkay-meta vahidkay-meta mentioned this pull request Jun 20, 2025
facebook-github-bot pushed a commit that referenced this pull request Jun 24, 2025
Summary:
*   Tweak - Add comprehensive unit tests for Locale class by sol-loup in #3362
*   Tweak - Add unit tests for Idempotent_Request trait by sol-loup in #3380
*   Tweak - Add comprehensive unit tests for MetaLog Response by sol-loup in #3376
*   Tweak - Add comprehensive unit tests for ProductSets Delete Response class by sol-loup in #3398
*   Fix - Since tags by sol-loup in #3397
*   Tweak - Add comprehensive unit tests for Pages Read Response by sol-loup in #3378
*   Tweak - Add comprehensive unit tests for User Response to improve code coverage by sol-loup in #3377
*   Fix - Linter errors for ./includes/fbproductfeed.php by ajello-meta in #3396
*   Tweak - Add unit tests for Events AAMSettings class by sol-loup in #3369
*   Tweak - Improve CAPI event handling & add logging for Purchase events by iodic in #3360
*   Fix - Adding links to the updated banner by SayanPandey in #3388
*   Fix - Removing deprecated tag from Product Sync tab by SayanPandey in #3387
*   Fix - Transmit opted_out_woo_all_products timestamp by vinkmeta in #3386
*   Tweak - Product sync tab deprecation using Rollout Switches by SayanPandey in #3364
*   Tweak - Excluded categories and tags from Rollout Switches by SayanPandey in #3382
*   Tweak - Add unit tests for ProductExcludedException and ProductInvalidException by sol-loup in #3357
*   Tweak - Global sync check for Rollout Switches by SayanPandey in #3367
*   Fix - Limiting BatchLogHandler processing for performance reasons by vinkmeta in #3381
*   Tweak - Add unit tests for Framework Api Exception class by sol-loup in #3370
*   Tweak - Add unit tests for Framework Plugin Exception class by sol-loup in #3371
*   Fix - Updated since tags across a few files by sol-loup in #3374
*   Fix - Deprecated the concept of tip info by vinkmeta in #3373
*   Fix - Removed instance of deprecated logger by vinkmeta in #3372
*   Fix - the process to share ExternalVersionUpdate with Meta by vinkmeta in #3365
*   Fix - Failing tests by vinkmeta in #3366
*   Fix - Deprecated legacy logging apis by vinkmeta in #3351
*   Fix - Issue with productSetSyncTest causing warnings during PHPUnit by sol-loup in #3355
*   Tweak - Add comprehensive unit tests for Events\Normalizer class by sol-loup in #3359
*   Tweak - Add unit tests for API Response classes to improve code coverage by sol-loup in #3358
*   Fix - Deprecated the concept of fblog by vinkmeta in #3354
*   Fix - Deprecated tool tip event concepts by vinkmeta in #3349
*   Fix - Removed unnecessary logs being sent to Meta servers by vinkmeta in #3347
*   Fix - Clean up info Banner releated class and components by vinkmeta in #3348
*   Fix - Sending backgroung syncing jobs action logs to Meta by vinkmeta in #3346
*   Fix - Tracking error messages being displayed to Admins by vinkmeta in #3345
*   Tweak - Workflow for Releasing Plugin by tzahgr in #3309
*   Fix - Deleted wp_ajax_ajax_sync_all_fb_products action by vinkmeta in #3343
*   Fix - Deprecated log_with_debug_mode_enabled by vinkmeta in #3342
*   Fix - Removed unnecessary logs by vinkmeta in #3341
*   Fix - removing duplicate logging by vinkmeta in #3337
*   Fix - Updated exception logs to centralized logger by vinkmeta in #3338
*   Fix - Migrated Feed Logger by vinkmeta in #3340
*   Fix - Deprecated log_to_meta functionality by vinkmeta in #3336
*   Fix - Enabled fbproduct for code sniffing in #3328
*   Fix - Enabled phpcs for plugin banners by vinkmeta in #3332
*   Fix - Updated loggers for Feeds by vinkmeta in #3335
*   Fix - Updated loggers for checkout flow by vinkmeta in #3334
*   Fix - Logging background product syncing debug logs by vinkmeta in #3329
*   Fix - Enabled Pixel Normalizer for CS by vinkmeta in #3333
*   Fix - Update to Feed Loggers by vinkmeta in #3330
*   Fix - Debug logs for background product syncing by vinkmeta in #3327
*   Add - Sync all products if user has opted-in for Woo All Products by SayanPandey in #3281
*   Fix - PHPUnit warnings by renaming test files to match their class names by sol-loup in #3311
*   Tweak - Removing exclusion of sync of excluded categories and tags by SayanPandey in #3244
*   Fix - Lints and phpcs issues with fbproduct by vinkmeta in #3324
*   Fix - Code sniffing fixes for fbproduct by vinkmeta in #3323
*   Fix - Migrated Product Feed Progress Logging Mechanism by vinkmeta in #3321
*   Fix - Added critical log when user attempting non-permissible actions by vinkmeta in #3322
*   Fix - Handling edge case with BatchLogHandler in #3320
*   Fix - Product Group Logging by vinkmeta in #3317
*   Fix - PHPCBF for fbproduct by vinkmeta in #3319
*   Fix - Linting for WC_Facebookcommerce_Background_Process by vinkmeta in #3318
*   Tweak - Adding tags on excluded categories and tags by SayanPandey in #3308
*   Tweak - Removing unnecessary modal for excluded categories by SayanPandey in #3307
*   Tweak - Removing delete on stock check by SayanPandey in #3306
*   Add - Showing a banner to the user about the changes by SayanPandey in #3256
*   Fix - Updated location for Product Feeds by vinkmeta in #3316
*   Tweak - Removing internal wiki links by vinkmeta in #3315
*   Add - Introducing a centralized logger by vinkmeta in #3313
*   Fix - Update ratings and reviews query logic and fix tests by nrostrow-meta in #3312
*   Fix - Restoring the product sync tagging with integers by SayanPandey in #3305
*   Tweak - Removing Enable Sync checkbox by SayanPandey in #3241
*   Fix - Flush rewrite rules to ensure /fb-checkout endpoint is working correctly by ajello-meta in #3301
*   Tweak - Deprecating Product Sync tab by SayanPandey in #3273
*   Tweak - Updated GitHub PR template by vinkmeta in #3304
*   Fix - Changed json_encode to wp_json_encode to avoid phpcs issues by vinkmeta in #3303
*   Fix - Replaced json_encode with wp_json_encode by vinkmeta in #3276
*   Fix - Linting issues resolved for includes/ProductSets/Sync.phpby sol-loup in #3188
*   Fix - Linting issues resolved for includes/Utilities/Background_Remove_Duplicate_Visibility_Meta.php by sol-loup in #3187
*   Fix - Linting issues resolved for includes/Events/Event.php by sol-loup in #3189
*   Tweak - Enable Video sync at Variable Product Level by gurtejrehal in #3291
*   Fix - Revert #3295 by vinkmeta in #3299

Pull Request resolved: #3444

Reviewed By: tzahgr

Differential Revision: D77219857

Pulled By: vahidkay-meta

fbshipit-source-id: 52148818ea2d6c1b937f3caa78e6071a258d17f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants