Skip to content

Commit

Permalink
Replace asciinema.org in tests (#71)
Browse files Browse the repository at this point in the history
* Replace asciinema.org in tests

The site no longer supports oEmbed

* Fix string
  • Loading branch information
swissspidy authored Jul 13, 2023
1 parent 531946f commit 8a482bd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
18 changes: 9 additions & 9 deletions features/fetch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ Feature: Manage oEmbed cache.

# Unknown provider requiring discovery but not returning iframe so would be sanitized for WP >= 4.4 without 'skip-sanitization' option.
# Old versions of WP_oEmbed can trigger PHP "Only variables should be passed by reference" notices on discover so use "try" to cater for these.
When I try `wp embed fetch https://asciinema.org/a/140798 --skip-sanitization`
When I try `wp embed fetch https://view.ceros.com/ceros/new-experience-3/p/1 --skip-sanitization`
Then the return code should be 0
And STDERR should not contain:
"""
Error:
"""
And STDOUT should contain:
"""
asciinema.org/
ceros.com/
"""
And STDOUT should contain:
"""
Expand All @@ -76,10 +76,10 @@ Feature: Manage oEmbed cache.
# WP 4.9 always returns clickable link even for sanitized oEmbed responses.
@require-wp-4.9
Scenario: Get HTML embed code for a given URL that requires discovery and is sanitized
When I run `wp embed fetch https://asciinema.org/a/140798`
When I run `wp embed fetch https://view.ceros.com/ceros/new-experience-3/p/1`
Then STDOUT should contain:
"""
asciinema.org/
ceros.com/
"""
And STDOUT should contain:
"""
Expand All @@ -89,7 +89,7 @@ Feature: Manage oEmbed cache.
# `wp_filter_oembed_result` filter introduced WP 4.4 which sanitizes oEmbed responses that don't include an iframe.
@less-than-wp-4.9 @require-wp-4.4
Scenario: Get HTML embed code for a given URL that requires discovery and is sanitized
When I try `wp embed fetch https://asciinema.org/a/140798`
When I try `wp embed fetch https://view.ceros.com/ceros/new-experience-3/p/1`
Then the return code should be 1
And STDERR should be:
"""
Expand All @@ -101,15 +101,15 @@ Feature: Manage oEmbed cache.
@less-than-wp-4.4 @require-wp-4.0
Scenario: Get HTML embed code for a given URL that requires discovery and is sanitized
# Old versions of WP_oEmbed can trigger PHP "Only variables should be passed by reference" notices on discover so use "try" to cater for these.
When I try `wp embed fetch https://asciinema.org/a/140798`
When I try `wp embed fetch https://view.ceros.com/ceros/new-experience-3/p/1`
Then the return code should be 0
And STDERR should not contain:
"""
Error:
"""
And STDOUT should contain:
"""
asciinema.org/
ceros.com/
"""

@require-wp-4.0
Expand All @@ -130,15 +130,15 @@ Feature: Manage oEmbed cache.

# Raw requests are not sanitized.
# Old versions of WP_oEmbed can trigger PHP "Only variables should be passed by reference" notices on discover so use "try" to cater for these.
When I try `wp embed fetch https://asciinema.org/a/140798 --raw`
When I try `wp embed fetch https://view.ceros.com/creative-services/sdk --raw`
Then the return code should be 0
And STDERR should not contain:
"""
Error:
"""
And STDOUT should contain:
"""
asciinema.org
ceros.com
"""

@require-wp-4.0
Expand Down
28 changes: 14 additions & 14 deletions features/provider.feature
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Feature: Manage oEmbed providers.

# Provider requiring discovery
# Old versions of WP_oEmbed can trigger PHP "Only variables should be passed by reference" notices on discover so use "try" to cater for these.
When I try `wp embed provider match https://asciinema.org/a/140798`
When I try `wp embed provider match https://audio.com/audio-com/collections/ambient-focus`
And save STDOUT as {DEFAULT_STDOUT}
Then the return code should be 0
And STDERR should not contain:
Expand All @@ -147,7 +147,7 @@ Feature: Manage oEmbed providers.
"""
And STDOUT should contain:
"""
asciinema.org/
audio.com/
"""
And STDOUT should contain:
"""
Expand All @@ -159,7 +159,7 @@ Feature: Manage oEmbed providers.
"""

# Old versions of WP_oEmbed can trigger PHP "Only variables should be passed by reference" notices on discover so use "try" to cater for these.
When I try `wp embed provider match https://asciinema.org/a/140798 --link-type=json`
When I try `wp embed provider match https://audio.com/audio-com/collections/ambient-focus --link-type=json`
Then the return code should be 0
And STDERR should not contain:
"""
Expand All @@ -171,7 +171,7 @@ Feature: Manage oEmbed providers.
"""

# Old versions of WP_oEmbed can trigger PHP "Only variables should be passed by reference" notices on discover so use "try" to cater for these.
When I try `wp embed provider match https://asciinema.org/a/140798 --link-type=xml`
When I try `wp embed provider match https://audio.com/audio-com/collections/ambient-focus --link-type=xml`
Then the return code should be 0
And STDERR should not contain:
"""
Expand All @@ -183,7 +183,7 @@ Feature: Manage oEmbed providers.
"""
And STDOUT should contain:
"""
asciinema.org/
audio.com/
"""
And STDOUT should contain:
"""
Expand All @@ -197,19 +197,19 @@ Feature: Manage oEmbed providers.
# Depends on `oembed_remote_get_args` filter introduced in WP 4.0 https://core.trac.wordpress.org/ticket/23442
@require-wp-4.0
Scenario: Discover a provider with limited response size
When I run `wp embed provider match https://asciinema.org/a/140798`
When I run `wp embed provider match https://audio.com/audio-com/collections/ambient-focus`
And save STDOUT as {DEFAULT_STDOUT}

# Response limit too small
When I try `wp embed provider match https://asciinema.org/a/140798 --limit-response-size=10`
When I try `wp embed provider match https://audio.com/audio-com/collections/ambient-focus --limit-response-size=10`
Then the return code should be 1
And STDERR should be:
"""
Error: No oEmbed provider found for given URL.
"""

# Response limit big enough
When I run `wp embed provider match https://asciinema.org/a/140798 --limit-response-size=50000`
When I run `wp embed provider match https://audio.com/audio-com/collections/ambient-focus --limit-response-size=50000`
Then STDOUT should be:
"""
{DEFAULT_STDOUT}
Expand Down Expand Up @@ -244,7 +244,7 @@ Feature: Manage oEmbed providers.

@require-wp-4.0
Scenario: Only match an oEmbed provider if discover
When I try `wp embed provider match https://asciinema.org/a/140798 --no-discover`
When I try `wp embed provider match https://audio.com/audio-com/collections/ambient-focus --no-discover`
Then the return code should be 1
And STDERR should be:
"""
Expand All @@ -253,31 +253,31 @@ Feature: Manage oEmbed providers.
And STDOUT should be empty

# Old versions of WP_oEmbed can trigger PHP "Only variables should be passed by reference" notices on discover so use "try" to cater for these.
When I try `wp embed provider match https://asciinema.org/a/140798`
When I try `wp embed provider match https://audio.com/audio-com/collections/ambient-focus`
Then the return code should be 0
And STDERR should not contain:
"""
Error:
"""
And STDOUT should contain:
"""
asciinema.org/
audio.com/
"""
And STDOUT should contain:
"""
140798
collection
"""

# Old versions of WP_oEmbed can trigger PHP "Only variables should be passed by reference" notices on discover so use "try" to cater for these.
When I try `wp embed provider match https://asciinema.org/a/140798 --discover`
When I try `wp embed provider match https://audio.com/audio-com/collections/ambient-focus --discover`
Then the return code should be 0
And STDERR should not contain:
"""
Error:
"""
And STDOUT should contain:
"""
asciinema.org/
audio.com/
"""

Scenario: Incompatible or wrong options
Expand Down

0 comments on commit 8a482bd

Please sign in to comment.