Example #1
0
 /**
  * Test if the secret is appended to the URL.
  */
 function test_filter_oembed_result_secret()
 {
     $html = '<iframe src="https://wordpress.org"></iframe>';
     $actual = wp_filter_oembed_result($html, '');
     $matches = array();
     preg_match('|src="https://wordpress.org#\\?secret=([\\w\\d]+)" data-secret="([\\w\\d]+)"|', $actual, $matches);
     $this->assertTrue(isset($matches[1]));
     $this->assertTrue(isset($matches[2]));
     $this->assertEquals($matches[1], $matches[2]);
 }
 /**
  * @group feed
  */
 function test_filter_feed_content()
 {
     $html = '<blockquote></blockquote><iframe></iframe>';
     $actual = _oembed_filter_feed_content(wp_filter_oembed_result($html, (object) array('type' => 'rich'), ''));
     $this->assertEquals('<blockquote class="wp-embedded-content"></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"></iframe>', $actual);
 }
 function test_filter_oembed_result_invalid_result()
 {
     $this->assertFalse(wp_filter_oembed_result(false, (object) array('type' => 'rich'), ''));
     $this->assertFalse(wp_filter_oembed_result('', (object) array('type' => 'rich'), ''));
 }