Skip to content

Commit 287303a

Browse files
authored
Tests: improve Windows compatibility (#92)
1 parent 25a2b9a commit 287303a

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

features/cache.feature

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ Feature: Manage oEmbed cache.
7777

7878
Scenario: Find oEmbed cache post ID for an existing key
7979
# Add a non-post embed, default attributes.
80-
When I run `wp eval 'echo $GLOBALS["wp_embed"]->run_shortcode( "[embed]https://www.youtube.com/watch?v=dQw4w9WgXcQ[/embed]" );'`
80+
Given a step1.php file:
81+
"""
82+
<?php echo $GLOBALS["wp_embed"]->run_shortcode( "[embed]https://www.youtube.com/watch?v=dQw4w9WgXcQ[/embed]" );
83+
"""
84+
When I run `wp eval-file step1.php`
8185
Then STDOUT should contain:
8286
"""
8387
dQw4w9WgXcQ
@@ -87,7 +91,11 @@ Feature: Manage oEmbed cache.
8791
Then STDOUT should be a number
8892

8993
# Add a non-post embed with width attribute.
90-
When I run `wp eval 'echo $GLOBALS["wp_embed"]->run_shortcode( "[embed width=400]https://www.youtube.com/watch?v=yPYZpwSpKmA[/embed]" );'`
94+
Given a step2.php file:
95+
"""
96+
<?php echo $GLOBALS["wp_embed"]->run_shortcode( "[embed width=400]https://www.youtube.com/watch?v=yPYZpwSpKmA[/embed]" );
97+
"""
98+
When I run `wp eval-file step2.php`
9199
Then STDOUT should contain:
92100
"""
93101
yPYZpwSpKmA
@@ -114,7 +122,11 @@ Feature: Manage oEmbed cache.
114122
And the return code should be 1
115123

116124
# Add a non-post embed with discover=1 attribute.
117-
When I run `wp eval 'echo $GLOBALS["wp_embed"]->run_shortcode( "[embed discover=1]https://www.youtube.com/watch?v=yBwD4iYcWC4[/embed]" );'`
125+
Given a step3.php file:
126+
"""
127+
<?php echo $GLOBALS["wp_embed"]->run_shortcode( "[embed discover=1]https://www.youtube.com/watch?v=yBwD4iYcWC4[/embed]" );
128+
"""
129+
When I run `wp eval-file step3.php`
118130
Then STDOUT should contain:
119131
"""
120132
yBwD4iYcWC4
@@ -137,7 +149,11 @@ Feature: Manage oEmbed cache.
137149
Then STDOUT should be a number
138150

139151
# Add a non-post embed with width and discover attributes.
140-
When I run `wp eval 'echo $GLOBALS["wp_embed"]->run_shortcode( "[embed width=450 discover=0]https://www.youtube.com/watch?v=eYuUAGXN0KM[/embed]" );'`
152+
Given a step4.php file:
153+
"""
154+
<?php echo $GLOBALS["wp_embed"]->run_shortcode( "[embed width=450 discover=0]https://www.youtube.com/watch?v=eYuUAGXN0KM[/embed]" );
155+
"""
156+
When I run `wp eval-file step4.php`
141157
Then STDOUT should contain:
142158
"""
143159
eYuUAGXN0KM
@@ -178,7 +194,11 @@ Feature: Manage oEmbed cache.
178194
#Then STDOUT should be a number
179195

180196
# Dummy data with default width/height.
181-
When I run `wp eval 'echo md5( "foo" . serialize( wp_embed_defaults() ) );'`
197+
Given a step5.php file:
198+
"""
199+
<?php echo md5( "foo" . serialize( wp_embed_defaults() ) );
200+
"""
201+
When I run `wp eval-file step5.php`
182202
Then STDOUT should not be empty
183203
And save STDOUT as {CACHE_KEY}
184204

@@ -193,7 +213,11 @@ Feature: Manage oEmbed cache.
193213
"""
194214

195215
# Dummy data with given width/height. Specify width/height as strings as that's what shortcode attributes will be passed as.
196-
When I run `wp eval 'echo md5( "foo" . serialize( array( "width" => "600", "height" => "400" ) ) );'`
216+
Given a step6.php file:
217+
"""
218+
<?php echo md5( "foo" . serialize( array( "width" => "600", "height" => "400" ) ) );
219+
"""
220+
When I run `wp eval-file step6.php`
197221
Then STDOUT should not be empty
198222
And save STDOUT as {CACHE_KEY}
199223

0 commit comments

Comments
 (0)