Skip to content

Conversation

@justinmaurerdotdev
Copy link

Fixes #64.
The command was directly instantiating the WP_oEmbed class, which meant none of the registered providers were in the providers array.

@justinmaurerdotdev justinmaurerdotdev requested a review from a team as a code owner August 26, 2025 23:41
@codecov
Copy link

codecov bot commented Aug 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

And STDOUT should be empty

@require-wp-4.0
Scenario: Only match an oEmbed provider if discover
Copy link
Member

Choose a reason for hiding this comment

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

How is this scenario related to the new code? It doesn't test anything with example.com

Then STDOUT should match /^(?:(?:1|0)\n)+$/

@require-wp-4.0
Scenario: Match an oEmbed provider
Copy link
Member

Choose a reason for hiding this comment

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

Ditto here, how does this scenario test the new code? audio.com and YouTube aren't really new providers, no?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes issue #64 where the list_providers command was directly instantiating the WP_oEmbed class instead of using the WordPress singleton, causing it to miss all dynamically registered oEmbed providers. The fix changes the instantiation to use _wp_oembed_get_object() which returns the singleton instance containing all registered providers.

Key changes:

  • Updated Provider_Command::list_providers() to use _wp_oembed_get_object() instead of new \WP_oEmbed()
  • Added comprehensive test suite to verify custom providers registered via wp_oembed_add_provider() are properly listed

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Provider_Command.php Changed from direct WP_oEmbed instantiation to singleton access via _wp_oembed_get_object() with explanatory comment
features/add-oembed-provider.feature Added comprehensive test scenarios verifying custom provider registration and listing functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"""
And STDOUT should contain:
"""
audio.com/
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

Inconsistent indentation: this line has an extra space before audio.com/. It should align with the other STDOUT expectations (line 263 has the correct indentation).

Suggested change
audio.com/
audio.com/

Copilot uses AI. Check for mistakes.
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.

Include oEmbed endpoints introduced by plugins to the wp embed provider list

2 participants