/** * @covers WPSEO_Twitter::type */ public function test_type() { // test invalid option, should default to summary self::$class_instance->options['twitter_card_type'] = 'something_invalid'; $expected = $this->metatag('card', 'summary'); self::$class_instance->type(); $this->expectOutput($expected); // test valid option self::$class_instance->options['twitter_card_type'] = 'photo'; $expected = $this->metatag('card', 'photo'); self::$class_instance->type(); $this->expectOutput($expected); }
/** * @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); }
public function type() { return parent::type(); }