/** * @covers WPSEO_Twitter::gallery_images_output() */ public function test_gallery_images() { $ids = array(); $expected = $this->metatag('card', 'gallery'); // Insert images into DB so we have something to test against foreach (range(0, 3) as $i) { $filename = "image{$i}.jpg"; $ids[] = $this->factory->attachment->create_object($filename, 0, array('post_mime_type' => 'image/jpeg', 'post_type' => 'attachment')); $expected .= $this->metatag('image' . $i, 'http://' . WP_TESTS_DOMAIN . "/wp-content/uploads/{$filename}"); } // Create and go to post $content = '[gallery ids="' . join(',', $ids) . '"]'; $post_id = $this->factory->post->create(array('post_content' => $content)); $this->go_to(get_permalink($post_id)); self::$class_instance->type(); self::$class_instance->image(); $this->expectOutput($expected); }
/** * @covers WPSEO_Twitter::site_domain */ public function test_image() { // create and go to post $post_id = $this->factory->post->create(); $this->go_to(get_permalink($post_id)); // test default image $image_url = 'http://url-default-image.jpg'; self::$class_instance->options['og_default_image'] = $image_url; $expected = $this->get_expected_image_output($image_url); self::$class_instance->image(); $this->expectOutput($expected); // reset default_image option self::$class_instance->options['og_default_image'] = ''; // TODO test og_frontpage_image // test wpseo meta value $image_url = 'http://url-singular-meta-image.jpg'; WPSEO_Meta::set_value('twitter-image', $image_url, $post_id); $expected = $this->get_expected_image_output($image_url); self::$class_instance->image(); $this->expectOutput($expected); // TODO test post thumbnail // TODO test post content image }
public function image() { return parent::image(); }