/** * @covers WPSEO_OpenGraph::opengraph */ public function test_opengraph() { self::$class_instance->opengraph(); $this->assertEquals(1, did_action('wpseo_opengraph')); ob_clean(); }
/** * Test if image in content is added to open graph * * @covers WPSEO_OpenGraph::image */ public function test_image_get_content_image() { $post_id = $this->factory->post->create(array('post_content' => '<img class="alignnone size-medium wp-image-490" src="' . get_site_url() . '/wp-content/plugins/wordpress-seo/tests/yoast.png" />')); $this->go_to(get_permalink($post_id)); $class_instance = new WPSEO_OpenGraph(); ob_start(); $class_instance->opengraph(); $output = ob_get_clean(); $expected_output = '<meta property="og:image" content="' . get_site_url() . '/wp-content/plugins/wordpress-seo/tests/yoast.png" />'; $this->assertContains($expected_output, $output); }