[wp-trac] [WordPress Trac] #52235: wp_extract_urls doesn't match localhost
WordPress Trac
noreply at wordpress.org
Wed Jan 6 11:37:27 UTC 2021
#52235: wp_extract_urls doesn't match localhost
--------------------------+------------------------------
Reporter: seanleavey | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.6
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by seanleavey):
This may also be related, but it seems that WordPress's testing bootstrap
doesn't set the `home_url()` to the contents of the constant
`WP_TESTS_DOMAIN`, so new posts created by e.g.
`$this->factory->post->create()` inside unit tests have their permalink
set to `localhost` (or presumably whatever the default is for the
platform). This means that creating a post in a test with `post_content`
set to contain a link to another post (retrieved via `get_permalink(
$other_post )`), then running `wp_extract_urls` on its content, results in
an array that doesn't contain the other post's URL.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52235#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list