Skip to content

Commit e28a4a4

Browse files
Tests: Rename some oEmbed test classes as per the naming conventions.
Includes moving the data provider after the corresponding test for consistency with the rest of the test suite. Follow-up to [34903], [62223], [62224]. See #64225. git-svn-id: https://develop.svn.wordpress.org/trunk@62227 602fd350-edb4-49c9-b593-d223f7449a82
1 parent bbb00c5 commit e28a4a4

File tree

2 files changed

+31
-25
lines changed

2 files changed

+31
-25
lines changed

tests/phpunit/tests/oembed/filterTitleAttributes.php renamed to tests/phpunit/tests/oembed/wpFilterOembedIframeTitleAttributes.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,21 @@
22

33
/**
44
* @group oembed
5+
*
6+
* @covers ::wp_filter_oembed_iframe_title_attribute
57
*/
6-
class Tests_Filter_oEmbed_Iframe_Title_Attribute extends WP_UnitTestCase {
7-
public function data_filter_oembed_iframe_title_attribute() {
8+
class Tests_oEmbed_wpFilterOembedIframeTitleAttribute extends WP_UnitTestCase {
9+
10+
/**
11+
* @dataProvider data_oembed_iframe_title_attribute
12+
*/
13+
public function test_oembed_iframe_title_attribute( $html, $oembed_data, $url, $expected ) {
14+
$actual = wp_filter_oembed_iframe_title_attribute( $html, (object) $oembed_data, $url );
15+
16+
$this->assertEqualHTML( $expected, $actual );
17+
}
18+
19+
public function data_oembed_iframe_title_attribute() {
820
return array(
921
array(
1022
'<p>Foo</p><iframe src=""></iframe><b>Bar</b>',
@@ -61,15 +73,6 @@ public function data_filter_oembed_iframe_title_attribute() {
6173
);
6274
}
6375

64-
/**
65-
* @dataProvider data_filter_oembed_iframe_title_attribute
66-
*/
67-
public function test_oembed_iframe_title_attribute( $html, $oembed_data, $url, $expected ) {
68-
$actual = wp_filter_oembed_iframe_title_attribute( $html, (object) $oembed_data, $url );
69-
70-
$this->assertEqualHTML( $expected, $actual );
71-
}
72-
7376
public function test_filter_oembed_iframe_title_attribute() {
7477
add_filter( 'oembed_iframe_title_attribute', array( $this, '_filter_oembed_iframe_title_attribute' ) );
7578

tests/phpunit/tests/oembed/filterResult.php renamed to tests/phpunit/tests/oembed/wpFilterOembedResult.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
/**
44
* @group oembed
5+
*
6+
* @covers ::wp_filter_oembed_result
57
*/
6-
class Tests_Filter_oEmbed_Result extends WP_UnitTestCase {
8+
class Tests_oEmbed_wpFilterOembedResult extends WP_UnitTestCase {
9+
710
public function test_filter_oembed_result_trusted_malicious_iframe() {
811
$html = '<p></p><iframe onload="alert(1)"></iframe>';
912

@@ -154,6 +157,19 @@ public function test_filter_oembed_result_allowed_html() {
154157
$this->assertEqualHTML( '<blockquote class="wp-embedded-content"><a href=""></a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; visibility: hidden;"></iframe>', $actual );
155158
}
156159

160+
/**
161+
* @dataProvider data_wp_filter_pre_oembed_custom_result
162+
*/
163+
public function test_wp_filter_pre_oembed_custom_result( $html, $expected ) {
164+
$data = (object) array(
165+
'type' => 'rich',
166+
'title' => 'Hola',
167+
'html' => $html,
168+
);
169+
$actual = _wp_oembed_get_object()->data2html( $data, 'https://untrusted.localhost' );
170+
$this->assertEqualHTML( $expected, $actual );
171+
}
172+
157173
public function data_wp_filter_pre_oembed_custom_result() {
158174
return array(
159175
array(
@@ -175,19 +191,6 @@ public function data_wp_filter_pre_oembed_custom_result() {
175191
);
176192
}
177193

178-
/**
179-
* @dataProvider data_wp_filter_pre_oembed_custom_result
180-
*/
181-
public function test_wp_filter_pre_oembed_custom_result( $html, $expected ) {
182-
$data = (object) array(
183-
'type' => 'rich',
184-
'title' => 'Hola',
185-
'html' => $html,
186-
);
187-
$actual = _wp_oembed_get_object()->data2html( $data, 'https://untrusted.localhost' );
188-
$this->assertEqualHTML( $expected, $actual );
189-
}
190-
191194
/**
192195
* @group feed
193196
*/

0 commit comments

Comments
 (0)