Skip to content

Commit 7186d8f

Browse files
authored
Merge pull request #57 from wp-cli/fix-behat-tests
2 parents 4741e47 + 0427182 commit 7186d8f

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

features/fetch.feature

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Feature: Manage oEmbed cache.
33
Background:
44
Given a WP install
55

6-
# Behavior that's the same for all WP versions.
6+
@require-wp-4.0
77
Scenario: Get HTML embed code for a given URL
88
# Known provider not requiring discovery.
99
When I run `wp embed fetch https://www.youtube.com/watch?v=dQw4w9WgXcQ --width=500`
@@ -98,7 +98,7 @@ Feature: Manage oEmbed cache.
9898
And STDOUT should be empty
9999

100100
# No sanitization prior to WP 4.4.
101-
@less-than-wp-4.4
101+
@less-than-wp-4.4 @require-wp-4.0
102102
Scenario: Get HTML embed code for a given URL that requires discovery and is sanitized
103103
# 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.
104104
When I try `wp embed fetch https://asciinema.org/a/140798`
@@ -112,6 +112,7 @@ Feature: Manage oEmbed cache.
112112
asciinema.org/
113113
"""
114114

115+
@require-wp-4.0
115116
Scenario: Get raw oEmbed data for a given URL
116117
When I run `wp embed fetch https://www.youtube.com/watch?v=dQw4w9WgXcQ --raw`
117118
And save STDOUT as {DEFAULT_STDOUT}
@@ -140,6 +141,7 @@ Feature: Manage oEmbed cache.
140141
asciinema.org
141142
"""
142143

144+
@require-wp-4.0
143145
Scenario: Fail then succeed when given unknown discoverable provider for a raw request, depending on discover option
144146
When I try `wp embed fetch http://LearningApps.org/259 --raw --no-discover`
145147
# Old versions of WP_oEmbed can trigger PHP "Only variables should be passed by reference" notices on discovery so use "contain" to ignore these.
@@ -160,6 +162,7 @@ Feature: Manage oEmbed cache.
160162
LearningApps.org
161163
"""
162164

165+
@require-wp-4.0
163166
Scenario: Bails when no oEmbed provider is found for a raw request
164167
When I try `wp embed fetch https://foo.example.com --raw`
165168
# Old versions of WP_oEmbed can trigger PHP "Only variables should be passed by reference" notices on discovery so use "contain" to ignore these.
@@ -168,6 +171,7 @@ Feature: Manage oEmbed cache.
168171
Error: No oEmbed provider found for given URL.
169172
"""
170173

174+
@require-wp-4.0
171175
Scenario: Bails when no oEmbed provider is found for a raw request and discovery is off
172176
When I try `wp embed fetch https://foo.example.com --raw --discover=0`
173177
Then STDERR should be:
@@ -185,7 +189,7 @@ Feature: Manage oEmbed cache.
185189
"""
186190

187191
# WP prior to 4.9 does not return clickable link.
188-
@less-than-wp-4.9
192+
@less-than-wp-4.9 @require-wp-4.0
189193
Scenario: Doesn't make unknown URLs clickable
190194
When I try `wp embed fetch https://foo.example.com`
191195
Then the return code should be 1
@@ -196,6 +200,7 @@ Feature: Manage oEmbed cache.
196200
"""
197201
And STDOUT should be empty
198202

203+
@require-wp-4.0
199204
Scenario: Caches oEmbed response data for a given post
200205
# Note need post author for 'unfiltered_html' check to work for WP < 4.4.
201206
When I run `wp post create --post_title="Foo Bar" --post_author=1 --porcelain`
@@ -220,6 +225,7 @@ Feature: Manage oEmbed cache.
220225
Success: Cleared oEmbed cache.
221226
"""
222227

228+
@require-wp-4.0
223229
Scenario: Return data as XML when requested
224230
When I run `wp embed fetch https://www.youtube.com/watch?v=dQw4w9WgXcQ --raw-format=xml --raw`
225231
Then STDOUT should contain:
@@ -348,6 +354,7 @@ Feature: Manage oEmbed cache.
348354
<iframe
349355
"""
350356

357+
@require-wp-4.0
351358
Scenario: Invoke built-in audio handler
352359
When I run `wp post create --post_title="Foo Bar" --porcelain`
353360
Then STDOUT should be a number
@@ -373,6 +380,7 @@ Feature: Manage oEmbed cache.
373380
<audio
374381
"""
375382

383+
@require-wp-4.0
376384
Scenario: Invoke built-in video handler
377385
When I run `wp post create --post_title="Foo Bar" --porcelain`
378386
Then STDOUT should be a number
@@ -399,7 +407,7 @@ Feature: Manage oEmbed cache.
399407
"""
400408

401409
# `wp_embed_handler_googlevideo` handler deprecated WP 4.6.
402-
@less-than-wp-4.6
410+
@less-than-wp-4.6 @require-wp-4.0
403411
Scenario: Invoke built-in Google Video handler
404412
When I run `wp post create --post_title="Foo Bar" --porcelain`
405413
Then STDOUT should be a number
@@ -415,6 +423,7 @@ Feature: Manage oEmbed cache.
415423
<embed
416424
"""
417425

426+
@require-wp-4.0
418427
Scenario: Incompatible options
419428
When I try `wp embed fetch https://www.example.com/watch?v=dQw4w9WgXcQ --no-discover --limit-response-size=50000`
420429
Then the return code should be 1

features/provider.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ Feature: Manage oEmbed providers.
127127
When I run `wp embed provider list --field=regex`
128128
Then STDOUT should match /^(?:(?:1|0)\n)+$/
129129

130+
@require-wp-4.0
130131
Scenario: Match an oEmbed provider
131132
# Provider not requiring discovery
132133
When I run `wp embed provider match https://www.youtube.com/watch?v=dQw4w9WgXcQ`
@@ -241,6 +242,7 @@ Feature: Manage oEmbed providers.
241242
"""
242243
And STDOUT should be empty
243244

245+
@require-wp-4.0
244246
Scenario: Only match an oEmbed provider if discover
245247
When I try `wp embed provider match https://asciinema.org/a/140798 --no-discover`
246248
Then the return code should be 1

0 commit comments

Comments
 (0)