Changeset 39172
- Timestamp:
- 11/08/2016 11:31:45 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/general/document-title.php
r38762 r39172 10 10 11 11 public $blog_name; 12 13 function setUp() { 14 parent::setUp(); 15 16 add_action( 'after_setup_theme', array( $this, '_add_title_tag_support' ) ); 17 18 $this->category_id = $this->factory->category->create( array( 12 public static $category_id; 13 public static $author_id; 14 public static $post_id; 15 16 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 17 self::$category_id = $factory->category->create( array( 19 18 'name' => 'test_category', 20 19 ) ); 21 20 22 $this->author_id = $this->factory->user->create( array(21 self::$author_id = $factory->user->create( array( 23 22 'role' => 'author', 24 23 'user_login' => 'test_author', … … 26 25 ) ); 27 26 28 $this->post_id = $this->factory->post->create( array(29 'post_author' => $this->author_id,27 self::$post_id = $factory->post->create( array( 28 'post_author' => self::$author_id, 30 29 'post_status' => 'publish', 31 30 'post_title' => 'test_title', 32 31 'post_type' => 'post', 33 32 'post_date' => '2015-09-22 18:52:17', 34 'category' => $this->category_id, 35 ) ); 33 'category' => self::$category_id, 34 ) ); 35 } 36 37 function setUp() { 38 parent::setUp(); 39 40 add_action( 'after_setup_theme', array( $this, '_add_title_tag_support' ) ); 36 41 37 42 $this->blog_name = get_option( 'blogname' ); 38 43 39 setup_postdata( get_post( $this->post_id ) );44 setup_postdata( get_post( self::$post_id ) ); 40 45 } 41 46 … … 127 132 128 133 function test_singular_title() { 129 $this->go_to( '?p=' . $this->post_id );134 $this->go_to( '?p=' . self::$post_id ); 130 135 131 136 add_filter( 'document_title_parts', array( $this, '_singular_title_parts' ) ); … … 143 148 144 149 function test_category_title() { 145 $this->go_to( '?cat=' . $this->category_id );150 $this->go_to( '?cat=' . self::$category_id ); 146 151 147 152 $this->assertEquals( sprintf( 'test_category – %s', $this->blog_name ), wp_get_document_title() ); … … 155 160 156 161 function test_author_title() { 157 $this->go_to( '?author=' . $this->author_id );162 $this->go_to( '?author=' . self::$author_id ); 158 163 159 164 $this->assertEquals( sprintf( 'test_author – %s', $this->blog_name ), wp_get_document_title() ); … … 203 208 204 209 function test_paged_post_title() { 205 $this->go_to( '?paged=4&p=' . $this->post_id );210 $this->go_to( '?paged=4&p=' . self::$post_id ); 206 211 207 212 add_filter( 'title_tag_parts', array( $this, '_paged_post_title_parts' ) ); … … 220 225 221 226 function test_rearrange_title_parts() { 222 $this->go_to( '?p=' . $this->post_id );227 $this->go_to( '?p=' . self::$post_id ); 223 228 224 229 add_filter( 'document_title_parts', array( $this, '_rearrange_title_parts' ) ); … … 237 242 238 243 function test_change_title_separator() { 239 $this->go_to( '?p=' . $this->post_id );244 $this->go_to( '?p=' . self::$post_id ); 240 245 241 246 add_filter( 'document_title_separator', array( $this, '_change_title_separator' ) );
Note: See TracChangeset
for help on using the changeset viewer.