Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions features/cache.feature
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Feature: Manage oEmbed cache.
# Add a non-post embed, default attributes.
Given a step1.php file:
"""
<?php echo $GLOBALS["wp_embed"]->run_shortcode( "[embed]https://www.youtube.com/watch?v=dQw4w9WgXcQ[/embed]" );
<?php echo $GLOBALS['wp_embed']->run_shortcode( '[embed]https://www.youtube.com/watch?v=dQw4w9WgXcQ[/embed]' );
"""
When I run `wp eval-file step1.php`
Then STDOUT should contain:
Expand All @@ -93,7 +93,7 @@ Feature: Manage oEmbed cache.
# Add a non-post embed with width attribute.
Given a step2.php file:
"""
<?php echo $GLOBALS["wp_embed"]->run_shortcode( "[embed width=400]https://www.youtube.com/watch?v=yPYZpwSpKmA[/embed]" );
<?php echo $GLOBALS['wp_embed']->run_shortcode( '[embed width=400]https://www.youtube.com/watch?v=yPYZpwSpKmA[/embed]' );
"""
When I run `wp eval-file step2.php`
Then STDOUT should contain:
Expand Down Expand Up @@ -124,7 +124,7 @@ Feature: Manage oEmbed cache.
# Add a non-post embed with discover=1 attribute.
Given a step3.php file:
"""
<?php echo $GLOBALS["wp_embed"]->run_shortcode( "[embed discover=1]https://www.youtube.com/watch?v=yBwD4iYcWC4[/embed]" );
<?php echo $GLOBALS['wp_embed']->run_shortcode( '[embed discover=1]https://www.youtube.com/watch?v=yBwD4iYcWC4[/embed]' );
"""
When I run `wp eval-file step3.php`
Then STDOUT should contain:
Expand All @@ -151,7 +151,7 @@ Feature: Manage oEmbed cache.
# Add a non-post embed with width and discover attributes.
Given a step4.php file:
"""
<?php echo $GLOBALS["wp_embed"]->run_shortcode( "[embed width=450 discover=0]https://www.youtube.com/watch?v=eYuUAGXN0KM[/embed]" );
<?php echo $GLOBALS['wp_embed']->run_shortcode( '[embed width=450 discover=0]https://www.youtube.com/watch?v=eYuUAGXN0KM[/embed]' );
"""
When I run `wp eval-file step4.php`
Then STDOUT should contain:
Expand Down Expand Up @@ -196,7 +196,7 @@ Feature: Manage oEmbed cache.
# Dummy data with default width/height.
Given a step5.php file:
"""
<?php echo md5( "foo" . serialize( wp_embed_defaults() ) );
<?php echo md5( 'foo' . serialize( wp_embed_defaults() ) );
"""
When I run `wp eval-file step5.php`
Then STDOUT should not be empty
Expand All @@ -215,7 +215,14 @@ Feature: Manage oEmbed cache.
# Dummy data with given width/height. Specify width/height as strings as that's what shortcode attributes will be passed as.
Given a step6.php file:
"""
<?php echo md5( "foo" . serialize( array( "width" => "600", "height" => "400" ) ) );
<?php echo md5(
'foo' . serialize(
array(
'width' => '600',
'height' => '400',
)
)
);
"""
When I run `wp eval-file step6.php`
Then STDOUT should not be empty
Expand Down
7 changes: 6 additions & 1 deletion features/handler.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ Feature: Manage embed handlers.

Given an embed_register_handler.php file:
"""
<?php WP_CLI::add_hook( 'after_wp_load', function() { wp_embed_register_handler( 'my_id', '/regex/', 'callback', 123 ); } );
<?php WP_CLI::add_hook(
'after_wp_load',
function () {
wp_embed_register_handler( 'my_id', '/regex/', 'callback', 123 );
}
);
"""

When I run `wp --require=embed_register_handler.php embed handler list`
Expand Down
11 changes: 7 additions & 4 deletions features/provider.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ Feature: Manage oEmbed providers.
And a filter-providers.php file:
"""
<?php
WP_CLI::add_wp_hook( 'oembed_providers', function ( $providers ) {
$providers['http://example.com/*'] = [ 'http://example.com/api/oembed.{format}', false ];
return $providers;
});
WP_CLI::add_wp_hook(
'oembed_providers',
function ( $providers ) {
$providers['http://example.com/*'] = [ 'http://example.com/api/oembed.{format}', false ];
return $providers;
}
);
"""

Scenario: List oEmbed providers
Expand Down