Skip to content

Enable code coverage report generation with phpunit#2893

Closed
carterbuce wants to merge 1 commit intofacebook:mainfrom
carterbuce:phpunit-code-coverage
Closed

Enable code coverage report generation with phpunit#2893
carterbuce wants to merge 1 commit intofacebook:mainfrom
carterbuce:phpunit-code-coverage

Conversation

@carterbuce
Copy link
Copy Markdown
Contributor

Changes proposed in this Pull Request:

The main change of this PR is adding a section in phpunit.xml.dist. This change, along with a local installation of a code coverage driver (xdebug), are required to get the coverage report working.

  • Do the changed files pass phpcs checks? Please remove phpcs:ignore comments in changed files and fix any issues, or delete if not practical.

Screenshots:

image

Detailed test instructions:

  1. pecl install xdebug-3.1.6
  2. Add xdebug.mode = coverage to php.ini or set environment variable XDEBUG_MODE=coverage
  3. ./vendor/bin/phpunit --coverage-html=reports/coverage
  4. open reports/coverage/index.html in web browser

Changelog entry

Enabled PHPUnit code coverage report generation

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@carterbuce 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

@carterbuce has updated the pull request. You must reimport the pull request before landing.

@carterbuce carterbuce force-pushed the phpunit-code-coverage branch from 2946b1b to 2de87af Compare February 24, 2025 19:57
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@carterbuce has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@carterbuce 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

@carterbuce merged this pull request in e8f0e84.

This was referenced Feb 25, 2025
facebook-github-bot pushed a commit that referenced this pull request Feb 26, 2025
Summary:
- Enable code coverage report generation with phpunit (#2893)
- [Cleanup] remove phpcs:ignoreFile annotations preventing code formatting on several smaller files

### Changes proposed in this Pull Request:

Closes # .

_Replace this with a good description of your changes & reasoning._

- [ ] Do the changed files pass `phpcs` checks? Please remove `phpcs:ignore` comments in changed files and fix any issues, or delete if not practical.

### Screenshots:

### Detailed test instructions:

Linting change. Just validate plugin works as expected.

### Additional details:

<!--
Optional.
Enter a summary of all changes in this Pull Request, which will be added to the changelog if accepted.
Each line should start with change type prefix`(Fix|Add|…) - `, for example:
> Break - A change breaking previous API or functionality.
> Add - A new feature, function or functionality was added.
> Update - Big changes to something that wasn't broken.
> Fix - Took care of something that wasn't working.
> Tweak - Small change, that isn't actually very important.
> Dev - Developer-facing only change.
> Doc - Updated customer or developer facing documentation

If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry.

Add the `changelog: none` label if no changelog entry is needed.
-->
### Changelog entry

> Went through project, found several unnecessary occurrences of phpcs:ignore-file and updated file to be compliant with linter

Pull Request resolved: #2897

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: bloks / Diff Version V4
https://internalfb.com/intern/testinfra/testrun/10414574208721470
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V4
https://internalfb.com/intern/testinfra/testrun/7881299600985996

Reviewed By: ajello-meta

Differential Revision: D70136766

Pulled By: sol-loup

fbshipit-source-id: 24448dfe6756256442438c33226d3225fd0964c9
@vahidkay-meta vahidkay-meta mentioned this pull request Feb 27, 2025
facebook-github-bot pushed a commit that referenced this pull request Feb 27, 2025
Summary:
### Changelog entry
* Tweak - Removed custom field definitions by devbodaghe in #2876
* Dev - Improved readability of function prepare_product() in fbproduct.php by mshymon in #2889
* Dev - Enabled PHPUnit code coverage report generation by carterbruce in #2893

Pull Request resolved: #2911

Reviewed By: tzahgr

Differential Revision: D70324082

Pulled By: vahidkay-meta

fbshipit-source-id: f7a05f5e5c392162dfcf2956eb8a7fb4381fe28a
facebook-github-bot pushed a commit that referenced this pull request Feb 28, 2025
Summary:
- Enable code coverage report generation with phpunit (#2893)
- [Cleanup] remove phpcs:ignoreFile annotations preventing code formatting on several smaller files
- Removing unneeded PHPCS-ignore for more files

### Changes proposed in this Pull Request:

Closes # .

_Replace this with a good description of your changes & reasoning._

- [ ] Do the changed files pass `phpcs` checks? Please remove `phpcs:ignore` comments in changed files and fix any issues, or delete if not practical.

### Screenshots:

### Detailed test instructions:

1.
2.
3.

### Additional details:

<!--
Optional.
Enter a summary of all changes in this Pull Request, which will be added to the changelog if accepted.
Each line should start with change type prefix`(Fix|Add|…) - `, for example:
> Break - A change breaking previous API or functionality.
> Add - A new feature, function or functionality was added.
> Update - Big changes to something that wasn't broken.
> Fix - Took care of something that wasn't working.
> Tweak - Small change, that isn't actually very important.
> Dev - Developer-facing only change.
> Doc - Updated customer or developer facing documentation

If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry.

Add the `changelog: none` label if no changelog entry is needed.
-->
### Changelog entry

>

Pull Request resolved: #2901

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: bloks / Diff Version V2
https://internalfb.com/intern/testinfra/testrun/15199648812872431
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V2
https://internalfb.com/intern/testinfra/testrun/8725724532540319

Reviewed By: carterbuce, ajello-meta

Differential Revision: D70353516

Pulled By: sol-loup

fbshipit-source-id: e58662afe8ac8175a5001e6481d85efdbf0957f5
vahidkay-meta pushed a commit that referenced this pull request Mar 5, 2025
Summary:
- Enable code coverage report generation with phpunit (#2893)
- [Cleanup] remove phpcs:ignoreFile annotations preventing code formatting on several smaller files

### Changes proposed in this Pull Request:

Closes # .

_Replace this with a good description of your changes & reasoning._

- [ ] Do the changed files pass `phpcs` checks? Please remove `phpcs:ignore` comments in changed files and fix any issues, or delete if not practical.

### Screenshots:

### Detailed test instructions:

Linting change. Just validate plugin works as expected.

### Additional details:

<!--
Optional.
Enter a summary of all changes in this Pull Request, which will be added to the changelog if accepted.
Each line should start with change type prefix`(Fix|Add|…) - `, for example:
> Break - A change breaking previous API or functionality.
> Add - A new feature, function or functionality was added.
> Update - Big changes to something that wasn't broken.
> Fix - Took care of something that wasn't working.
> Tweak - Small change, that isn't actually very important.
> Dev - Developer-facing only change.
> Doc - Updated customer or developer facing documentation

If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry.

Add the `changelog: none` label if no changelog entry is needed.
-->
### Changelog entry

> Went through project, found several unnecessary occurrences of phpcs:ignore-file and updated file to be compliant with linter

Pull Request resolved: #2897

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: bloks / Diff Version V4
https://internalfb.com/intern/testinfra/testrun/10414574208721470
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V4
https://internalfb.com/intern/testinfra/testrun/7881299600985996

Reviewed By: ajello-meta

Differential Revision: D70136766

Pulled By: sol-loup

fbshipit-source-id: 24448dfe6756256442438c33226d3225fd0964c9
vahidkay-meta pushed a commit that referenced this pull request Mar 5, 2025
Summary:
- Enable code coverage report generation with phpunit (#2893)
- [Cleanup] remove phpcs:ignoreFile annotations preventing code formatting on several smaller files
- Removing unneeded PHPCS-ignore for more files

### Changes proposed in this Pull Request:

Closes # .

_Replace this with a good description of your changes & reasoning._

- [ ] Do the changed files pass `phpcs` checks? Please remove `phpcs:ignore` comments in changed files and fix any issues, or delete if not practical.

### Screenshots:

### Detailed test instructions:

1.
2.
3.

### Additional details:

<!--
Optional.
Enter a summary of all changes in this Pull Request, which will be added to the changelog if accepted.
Each line should start with change type prefix`(Fix|Add|…) - `, for example:
> Break - A change breaking previous API or functionality.
> Add - A new feature, function or functionality was added.
> Update - Big changes to something that wasn't broken.
> Fix - Took care of something that wasn't working.
> Tweak - Small change, that isn't actually very important.
> Dev - Developer-facing only change.
> Doc - Updated customer or developer facing documentation

If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry.

Add the `changelog: none` label if no changelog entry is needed.
-->
### Changelog entry

>

Pull Request resolved: #2901

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: bloks / Diff Version V2
https://internalfb.com/intern/testinfra/testrun/15199648812872431
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V2
https://internalfb.com/intern/testinfra/testrun/8725724532540319

Reviewed By: carterbuce, ajello-meta

Differential Revision: D70353516

Pulled By: sol-loup

fbshipit-source-id: e58662afe8ac8175a5001e6481d85efdbf0957f5
tzahgr pushed a commit that referenced this pull request Mar 17, 2025
Summary:

The main change of this PR is adding a <coverage> section in phpunit.xml.dist. This change, along with a local installation of a code coverage driver (xdebug), are required to get the coverage report working.

- [x] Do the changed files pass `phpcs` checks? Please remove `phpcs:ignore` comments in changed files and fix any issues, or delete if not practical.

<img width="1524" alt="image" src="https://github.com/user-attachments/assets/870b0fc3-bf0d-4eeb-b956-e0f8e1e0b870" />

1. pecl install xdebug-3.1.6
2. Add xdebug.mode = coverage to php.ini or set environment variable XDEBUG_MODE=coverage
3. `./vendor/bin/phpunit --coverage-html=reports/coverage`
4. open reports/coverage/index.html in web browser

> Enabled PHPUnit code coverage report generation

Pull Request resolved: #2893

Reviewed By: Jmencab

Differential Revision: D70021799

Pulled By: carterbuce

fbshipit-source-id: 6a4c5204bbbf512b38c75f6aa1a820b3514a58d8
@vahidkay-meta vahidkay-meta mentioned this pull request Mar 19, 2025
vahidkay-meta added a commit that referenced this pull request Mar 24, 2025
Add - Items batch request and response tests by @nrostrow-meta in #2917
Tweak - Always run PHP-based github workflows by @carterbuce in #2926
Fix - feed upload error "feed_column_count_mismatch" when product has multiple colors separated by a comma by @mshymon in #2947
Tweak - Updated Pull Request Template by @vinkmeta in #2948
Tweak - Enabled PHPUnit code coverage report generation by @carterbuce in #2893
Dev - Improved readability of function prepare_product() in fbproduct.php by @mshymon in #2889
tzahgr pushed a commit that referenced this pull request Mar 24, 2025
Summary:
- Enable code coverage report generation with phpunit (#2893)
- [Cleanup] remove phpcs:ignoreFile annotations preventing code formatting on several smaller files
- Removing unneeded PHPCS-ignore for more files

### Changes proposed in this Pull Request:

Closes # .

_Replace this with a good description of your changes & reasoning._

- [ ] Do the changed files pass `phpcs` checks? Please remove `phpcs:ignore` comments in changed files and fix any issues, or delete if not practical.

### Screenshots:

### Detailed test instructions:

1.
2.
3.

### Additional details:

<!--
Optional.
Enter a summary of all changes in this Pull Request, which will be added to the changelog if accepted.
Each line should start with change type prefix`(Fix|Add|…) - `, for example:
> Break - A change breaking previous API or functionality.
> Add - A new feature, function or functionality was added.
> Update - Big changes to something that wasn't broken.
> Fix - Took care of something that wasn't working.
> Tweak - Small change, that isn't actually very important.
> Dev - Developer-facing only change.
> Doc - Updated customer or developer facing documentation

If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry.

Add the `changelog: none` label if no changelog entry is needed.
-->
### Changelog entry

>

Pull Request resolved: #2901

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: bloks / Diff Version V2
https://internalfb.com/intern/testinfra/testrun/15199648812872431
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V2
https://internalfb.com/intern/testinfra/testrun/8725724532540319

Reviewed By: carterbuce, ajello-meta

Differential Revision: D70353516

Pulled By: sol-loup

fbshipit-source-id: e58662afe8ac8175a5001e6481d85efdbf0957f5
tzahgr pushed a commit that referenced this pull request Mar 24, 2025
Summary:
- Enable code coverage report generation with phpunit (#2893)
- [Cleanup] remove phpcs:ignoreFile annotations preventing code formatting on several smaller files

### Changes proposed in this Pull Request:

Closes # .

_Replace this with a good description of your changes & reasoning._

- [ ] Do the changed files pass `phpcs` checks? Please remove `phpcs:ignore` comments in changed files and fix any issues, or delete if not practical.

### Screenshots:

### Detailed test instructions:

Linting change. Just validate plugin works as expected.

### Additional details:

<!--
Optional.
Enter a summary of all changes in this Pull Request, which will be added to the changelog if accepted.
Each line should start with change type prefix`(Fix|Add|…) - `, for example:
> Break - A change breaking previous API or functionality.
> Add - A new feature, function or functionality was added.
> Update - Big changes to something that wasn't broken.
> Fix - Took care of something that wasn't working.
> Tweak - Small change, that isn't actually very important.
> Dev - Developer-facing only change.
> Doc - Updated customer or developer facing documentation

If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry.

Add the `changelog: none` label if no changelog entry is needed.
-->
### Changelog entry

> Went through project, found several unnecessary occurrences of phpcs:ignore-file and updated file to be compliant with linter

Pull Request resolved: #2897

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: bloks / Diff Version V4
https://internalfb.com/intern/testinfra/testrun/10414574208721470
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V4
https://internalfb.com/intern/testinfra/testrun/7881299600985996

Reviewed By: ajello-meta

Differential Revision: D70136766

Pulled By: sol-loup

fbshipit-source-id: 24448dfe6756256442438c33226d3225fd0964c9
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