/**
  * @covers WPSEO_Frontend::robots
  *
  * @todo test post type archives
  * @todo test with noodp and noydir option set
  * @todo test with page_for_posts option
  * @todo test date archives
  * @todo test search results
  */
 public function test_robots()
 {
     // go to home
     $this->go_to_home();
     // test home page with no special options
     $expected = '';
     $this->assertEquals($expected, self::$class_instance->robots());
     $expected = 'noindex,follow';
     // test WP visibility setting
     update_option('blog_public', '0');
     $this->assertEquals($expected, self::$class_instance->robots());
     // clean-up
     update_option('blog_public', '1');
     // test replytocom
     $_GET['replytocom'] = '1';
     $this->assertEquals($expected, self::$class_instance->robots());
     // clean-up
     unset($_GET['replytocom']);
     // test 'paged' query var
     set_query_var('paged', 2);
     $expected = '';
     $this->assertEquals($expected, self::$class_instance->robots());
     // test 'paged' query var (2)
     $expected = 'noindex,follow';
     self::$class_instance->options['noindex-subpages-wpseo'] = true;
     $this->assertEquals($expected, self::$class_instance->robots());
     // clean-up
     self::$class_instance->options['noindex-subpages-wpseo'] = false;
     set_query_var('paged', 0);
     // create and go to post
     $post_id = $this->factory->post->create();
     $this->go_to(get_permalink($post_id));
     // test regular post with no special options
     $expected = '';
     $this->assertEquals($expected, self::$class_instance->robots());
     // test noindex-post option
     $expected = 'noindex,follow';
     self::$class_instance->options['noindex-post'] = true;
     $this->assertEquals($expected, self::$class_instance->robots());
     // clean-up
     self::$class_instance->options['noindex-post'] = false;
     // test post_status private
     $expected = 'noindex,follow';
     // test private posts
     global $post;
     $post->post_status = 'private';
     $this->assertEquals($expected, self::$class_instance->robots());
     // go to category page
     $category_id = wp_create_category('Category Name');
     // add posts to category
     $this->factory->post->create_many(6, array('post_category' => array($category_id)));
     $category_link = get_category_link($category_id);
     $this->go_to($category_link);
     // test regular category with no special options
     $expected = '';
     $this->assertEquals($expected, self::$class_instance->robots());
     // test category with noindex-tax-category option
     // TODO fix test for multisite (or code?)
     if (false === is_multisite()) {
         $expected = 'noindex,follow';
         self::$class_instance->options['noindex-tax-category'] = true;
         $this->assertEquals($expected, self::$class_instance->robots());
         // clean-up
         self::$class_instance->options['noindex-tax-category'] = false;
         // test subpages of category archives
         update_site_option('posts_per_page', 1);
         self::$class_instance->options['noindex-subpages-wpseo'] = true;
         $this->go_to(add_query_arg(array('paged' => 2), $category_link));
         $expected = 'noindex,follow';
         $this->assertEquals($expected, self::$class_instance->robots());
     }
     // go to author page
     $user_id = $this->factory->user->create();
     $this->go_to(get_author_posts_url($user_id));
     // test author archive with no special options
     $expected = '';
     $this->assertEquals($expected, self::$class_instance->robots());
     // test author archive with 'noindex-author-wpseo'
     $expected = 'noindex,follow';
     self::$class_instance->options['noindex-author-wpseo'] = true;
     $this->assertEquals($expected, self::$class_instance->robots());
     // clean-up
     self::$class_instance->options['noindex-author-wpseo'] = false;
 }