Skip to content

Tests: Cover wp_is_heic_image_mime_type() - #15800

Open
devmuhib009 wants to merge 2 commits into
WordPress:trunkfrom
devmuhib009:test/cover-wp-is-heic-image-mime-type
Open

devmuhib009 wants to merge 2 commits into
WordPress:trunkfrom
devmuhib009:test/cover-wp-is-heic-image-mime-type

Conversation

@devmuhib009

@devmuhib009 devmuhib009 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Description

Adds unit tests for the wp_is_heic_image_mime_type() function in src/wp-includes/functions.php.

The tests cover:

  • Validating supported HEIC and HEIF MIME types (image/heic, image/heif, image/heic-sequence, image/heif-sequence) return true.
  • Validating non-HEIC MIME types (image/jpeg, image/png, image/webp, image/avif, application/pdf, empty string) return false.
  • Data providers declared as public static for PHPUnit 10+ compatibility.

Test-only change.

Testing Instructions

npm run test:php -- --filter Tests_Functions_WpIsHeicImageMimeType
npm run test:php -- -c tests/phpunit/multisite.xml --filter Tests_Functions_WpIsHeicImageMimeType
vendor/bin/phpcs tests/phpunit/tests/functions/wpIsHeicImageMimeType.php

Trac ticket: https://core.trac.wordpress.org/ticket/66624

See #65819.
Props devmuhib009.
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props devmuhib, huzaifaalmesbah, lancewillett.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@huzaifaalmesbah huzaifaalmesbah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, @devmuhib009! Clean coverage for wp_is_heic_image_mime_type() across HEIC/HEIF and standard image MIME types.

Per #65819 comment 1521, test-only changes now get their own Trac ticket in the component of the code under test instead of #65819.

For image MIME-type validation, the most fitting component is Media (or General).

Could you please:

  1. Open a new Trac ticket in Media (or General) with the has-patch and has-unit-tests keywords and link this PR.
  2. Update the Trac ticket: reference in this PR's description.
  3. Update the @ticket 65819 annotations in wpIsHeicImageMimeType.php with the new ticket ID.

AI Review: Gemini 3.8 Flash

See #66624.
Props devmuhib009.
@lancewillett

Copy link
Copy Markdown
Member

@devmuhib009 this note covers your new-test PRs and Trac tickets, including the 13 opened Nov 7 (#15788–#15800, Trac #66610–#66624).

New tests in Core need to earn their place. The bar, from #52895 comment 207: "Ideally new tests are in relation to a broken feature, bug/regression, versus just adding coverage for its own sake." A function with no tests isn't enough reason on its own. Every test adds run time and upkeep for everyone who works on that code.

Before anyone reviews these:

  1. Please hold off on opening more.
  2. For each PR, add to its Trac ticket the bug or regression it would have caught, with a link to the ticket or changeset where that happened. Close the PRs and tickets that don't have one.
  3. Several tickets are typed "defect (bug)" but describe new coverage, with no bug. Please set those to "enhancement". Trac #66616 and #66617 are duplicates for wp_login_form(); please close one.

New tests go to the maintainers of each ticket's component for review and landing. I won't be reviewing these for Build/Test Tools. This doesn't change the hold on the #65893 series, which stands per #65893 comment 656.

AI review · claude-opus-5-5

@devmuhib009

Copy link
Copy Markdown
Member Author

Thank you for taking the time to provide this feedback and for clarifying the expectations around new tests in WordPress Core.

I understand the concern about adding tests solely for coverage without a clear connection to a bug or regression. I’ll hold off on opening additional PRs and review each existing PR and Trac ticket accordingly.

I’ll identify the specific bug or regression each test would have caught, add the relevant ticket or changeset references, and close the PRs and tickets that don't meet this requirement. I’ll also review the ticket types, update them to enhancements where appropriate, and resolve the duplicate tickets for wp_login_form().

I appreciate the guidance and will make sure my future contributions align with the Core team's testing standards and component maintainers' review process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants