Skip to content

fix skipped tests2#3058

Closed
sol-loup wants to merge 2 commits intomainfrom
fix-skipped-tests2
Closed

fix skipped tests2#3058
sol-loup wants to merge 2 commits intomainfrom
fix-skipped-tests2

Conversation

@sol-loup
Copy link
Copy Markdown
Contributor

@sol-loup sol-loup commented Apr 14, 2025

Description

This PR addresses noisy error logs originating from WC_Facebookcommerce_Utils::fblog during PHPUnit tests in WCFacebookCommerceIntegrationTest. These errors occurred because the wc_facebook_external_merchant_settings_id option (External Merchant Settings ID) was not set during test execution, leading to false positive error messages like "external merchant setting is null".

The fix involves initializing this option with a dummy value ('dummy_ems_id') within the setUp() method of the WCFacebookCommerceIntegrationTest class. This ensures the setting is present before relevant tests run, preventing the erroneous fblog calls.

Additionally, this PR includes the following test cleanup:

  • Deleted the test test_allow_full_batch_api_sync_uses_allow_full_batch_api_sync_filter as it was testing a deprecated option (allow_full_batch_api_sync) and was already marked as skipped.
  • Removed markTestSkipped annotations from test_get_js_sdk_version_returns_id_from_options_using_no_filter and test_get_js_sdk_version_returns_id_with_filter as they now pass successfully.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Syntax change (non-breaking change which fixes code modularity, linting or phpcs issues)

Checklist

  • [] I have commented my code, particularly in hard-to-understand areas.
  • [] I have confirmed that my changes do not introduce any new PHPCS warnings or 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

Fix - Prevent spurious error logs during unit tests by initializing external merchant settings ID.
Fix - Remove obsolete/skipped unit tests and enable previously skipped tests that now pass.

Pull Request resolved: #3058
GitHub Author: Paul Kang sollipse@meta.com

@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 f13b86f.

rubycalling pushed a commit that referenced this pull request Apr 16, 2025
Summary:
## Description

This PR addresses noisy error logs originating from `WC_Facebookcommerce_Utils::fblog` during PHPUnit tests in `WCFacebookCommerceIntegrationTest`. These errors occurred because the `wc_facebook_external_merchant_settings_id` option (External Merchant Settings ID) was not set during test execution, leading to false positive error messages like "external merchant setting is null".

The fix involves initializing this option with a dummy value (`'dummy_ems_id'`) within the `setUp()` method of the `WCFacebookCommerceIntegrationTest` class. This ensures the setting is present before relevant tests run, preventing the erroneous `fblog` calls.

Additionally, this PR includes the following test cleanup:
- Deleted the test `test_allow_full_batch_api_sync_uses_allow_full_batch_api_sync_filter` as it was testing a deprecated option (`allow_full_batch_api_sync`) and was already marked as skipped.
- Removed `markTestSkipped` annotations from `test_get_js_sdk_version_returns_id_from_options_using_no_filter` and `test_get_js_sdk_version_returns_id_with_filter` as they now pass successfully.

### Type of change

- Bug fix (non-breaking change which fixes an issue)
- Syntax change (non-breaking change which fixes code modularity, linting or phpcs issues)

## Checklist

- [] I have commented my code, particularly in hard-to-understand areas.
- [] I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
- [] I followed general Pull Request best practices. Meta employees to follow this [wiki](https://fburl.com/wiki/2cgfduwc).
- [] 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](https://fburl.com/wiki/nhx73tgs).

## Changelog entry

Fix - Prevent spurious error logs during unit tests by initializing external merchant settings ID.
Fix - Remove obsolete/skipped unit tests and enable previously skipped tests that now pass.

Pull Request resolved: #3058

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/6192449709976434
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/14073748913725649

Reviewed By: carterbuce

Differential Revision: D72987618

Pulled By: sol-loup

fbshipit-source-id: 8e0762d8462ddbe95a31555c061d53e3fdd931f5
mradmeta pushed a commit to mradmeta/facebook-for-woocommerce that referenced this pull request Apr 22, 2025
Summary:
## Description

This PR addresses noisy error logs originating from `WC_Facebookcommerce_Utils::fblog` during PHPUnit tests in `WCFacebookCommerceIntegrationTest`. These errors occurred because the `wc_facebook_external_merchant_settings_id` option (External Merchant Settings ID) was not set during test execution, leading to false positive error messages like "external merchant setting is null".

The fix involves initializing this option with a dummy value (`'dummy_ems_id'`) within the `setUp()` method of the `WCFacebookCommerceIntegrationTest` class. This ensures the setting is present before relevant tests run, preventing the erroneous `fblog` calls.

Additionally, this PR includes the following test cleanup:
- Deleted the test `test_allow_full_batch_api_sync_uses_allow_full_batch_api_sync_filter` as it was testing a deprecated option (`allow_full_batch_api_sync`) and was already marked as skipped.
- Removed `markTestSkipped` annotations from `test_get_js_sdk_version_returns_id_from_options_using_no_filter` and `test_get_js_sdk_version_returns_id_with_filter` as they now pass successfully.

### Type of change

- Bug fix (non-breaking change which fixes an issue)
- Syntax change (non-breaking change which fixes code modularity, linting or phpcs issues)

## Checklist

- [] I have commented my code, particularly in hard-to-understand areas.
- [] I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
- [] I followed general Pull Request best practices. Meta employees to follow this [wiki](https://fburl.com/wiki/2cgfduwc).
- [] 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](https://fburl.com/wiki/nhx73tgs).

## Changelog entry

Fix - Prevent spurious error logs during unit tests by initializing external merchant settings ID.
Fix - Remove obsolete/skipped unit tests and enable previously skipped tests that now pass.

Pull Request resolved: facebook#3058

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/6192449709976434
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/14073748913725649

Reviewed By: carterbuce

Differential Revision: D72987618

Pulled By: sol-loup

fbshipit-source-id: 8e0762d8462ddbe95a31555c061d53e3fdd931f5
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