/** * @covers WPSEO_Frontend::get_content_title */ public function test_get_content_title() { // create and go to post $post_id = $this->factory->post->create(); $this->go_to(get_permalink($post_id)); $this->assertFalse(self::$class_instance->is_home_posts_page()); // test title according to format $expected_title = self::$class_instance->get_title_from_options('title-post', get_queried_object()); $this->assertEquals($expected_title, self::$class_instance->get_content_title()); // test explicit post title $explicit_title = 'WPSEO Post Title %%sitename%%'; WPSEO_Meta::set_value('title', $explicit_title, $post_id); $post = get_post($post_id); $expected_title = wpseo_replace_vars($explicit_title, $post); $this->assertEquals($expected_title, self::$class_instance->get_content_title()); }