/** * Test the wp_oembed_excerpt_more function. */ function test_wp_oembed_excerpt_more() { $GLOBALS['wp_query'] = new WP_Query(); $GLOBALS['wp_query']->query_vars['embed'] = true; $GLOBALS['post'] = $this->factory->post->create_and_get(array('post_content' => 'Foo Bar')); $actual = wp_oembed_excerpt_more(''); $this->assertEquals(' <span class="wp-embed-more">… (2 words)‎</span>', $actual); }
/** * Test excerpt function. */ function test_wp_oembed_excerpt_more() { $post_id = $this->factory->post->create(array('post_content' => 'Foo Bar')); $this->assertEquals('', wp_oembed_excerpt_more('')); $this->go_to(get_post_embed_url($post_id)); $actual = wp_oembed_excerpt_more(''); $expected = sprintf('… <a class="wp-embed-more" href="%s" target="_top">Read more</a>', get_the_permalink()); $this->assertEquals($expected, $actual); }