You appear to be a bot. Output may be restricted
Description
Usage
Tests_Media::test_get_media_embedded_in_content();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/media.php
Lines:
1 to 64 of 64
function test_get_media_embedded_in_content() { $object = <<<OBJ <object src="this" data="that"> <param name="value"/> </object> OBJ; $embed = <<<EMBED <embed src="something.mp4"/> EMBED; $iframe = <<<IFRAME <iframe src="youtube.com" width="7000" /> IFRAME; $audio = <<<AUDIO <audio preload="none"> <source /> </audio> AUDIO; $video = <<<VIDEO <video preload="none"> <source /> </video> VIDEO; $content = <<<CONTENT This is a comment $object This is a comment $embed This is a comment $iframe This is a comment $audio This is a comment $video This is a comment CONTENT; $types = array( 'object', 'embed', 'iframe', 'audio', 'video' ); $contents = array_values( compact( $types ) ); $matches = get_media_embedded_in_content( $content, 'audio' ); $this->assertEquals( array( $audio ), $matches ); $matches = get_media_embedded_in_content( $content, 'video' ); $this->assertEquals( array( $video ), $matches ); $matches = get_media_embedded_in_content( $content, 'object' ); $this->assertEquals( array( $object ), $matches ); $matches = get_media_embedded_in_content( $content, 'embed' ); $this->assertEquals( array( $embed ), $matches ); $matches = get_media_embedded_in_content( $content, 'iframe' ); $this->assertEquals( array( $iframe ), $matches ); $matches = get_media_embedded_in_content( $content, $types ); $this->assertEquals( $contents, $matches ); }