Skip to content

Conversation

sol-loup
Copy link
Contributor

Description

This PR adds comprehensive unit test coverage for the previously untested FBE Configuration Read Response class. The tests ensure the class behaves correctly under various scenarios including edge cases with missing or malformed data.

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. Meta employees to follow this wiki.
  • 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). Meta employees to follow this wiki.

Changelog entry

Add unit test coverage for FBE Configuration Read Response class

Test Plan

  1. Run the unit tests with: composer test or ./vendor/bin/phpunit tests/Unit/Api/FBE/Configuration/Read/FBEConfigurationReadResponseTest.php
  2. All tests should pass
  3. The tests cover:
    • Class existence and inheritance verification
    • is_ig_shopping_enabled() method with various data scenarios
    • is_ig_cta_enabled() method with various data scenarios
    • get_commerce_extension_uri() method
    • Handling of missing, null, and malformed data
    • Error suppression for implementation bugs where array keys are accessed before null coalescing

Screenshots

Not applicable - this PR only adds unit tests

sol-loup added 4 commits June 17, 2025 12:43
- Test class existence and inheritance

- Test is_ig_shopping_enabled method with various scenarios

- Test is_ig_cta_enabled method with various scenarios

- Test get_commerce_extension_uri method

- Test handling of missing, null, and malformed data

These tests improve code coverage for the previously untested FBE Configuration Read Response class.
- Added error suppression (@) for tests that trigger implementation bug

- The implementation incorrectly accesses array keys before null coalescing operator

- This causes 'Undefined array key' errors when fields are missing

Tests now accurately reflect the actual behavior including the implementation's limitations.
Copy link
Contributor

📦 Latest Plugin Build

Built at: 2025-06-23T17:15:08.940Z
Commit: 2743780
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
Contributor

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

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