Changes from branches/4.4/tests/phpunit/tests/general/document-title.php at r36169 to trunk/tests/phpunit/tests/general/document-title.php at r35334
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/general/document-title.php
r36169 r35334 80 80 function test_front_page_title() { 81 81 update_option( 'show_on_front', 'page' ); 82 update_option( 'page_for_posts', $this->factory->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) ) ); 82 83 update_option( 'page_on_front', $this->factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) ); 83 add_filter( 'document_title_parts', array( $this, '_front_page_title_parts' ) ); 84 85 $this->go_to( '/' ); 84 85 $this->go_to( '/' ); 86 87 $this->assertEquals( sprintf( 'front-page – %s', $this->blog_name ), wp_get_document_title() ); 88 89 update_option( 'show_on_front', 'posts' ); 90 } 91 92 function test_home_title() { 93 $this->go_to( '/' ); 94 95 add_filter( 'document_title_parts', array( $this, '_home_title_parts' ) ); 96 86 97 $this->assertEquals( sprintf( '%s – Just another WordPress site', $this->blog_name ), wp_get_document_title() ); 87 88 update_option( 'show_on_front', 'posts' ); 89 90 $this->go_to( '/' ); 91 $this->assertEquals( sprintf( '%s – Just another WordPress site', $this->blog_name ), wp_get_document_title() ); 92 } 93 94 function _front_page_title_parts( $parts ) { 98 } 99 100 function _home_title_parts( $parts ) { 95 101 $this->assertArrayHasKey( 'title', $parts ); 96 102 $this->assertArrayHasKey( 'tagline', $parts ); … … 98 104 99 105 return $parts; 100 }101 102 function test_home_title() {103 $blog_page_id = $this->factory->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) );104 update_option( 'show_on_front', 'page' );105 update_option( 'page_for_posts', $blog_page_id );106 107 // Show page name on home page if it's not the front page.108 $this->go_to( get_permalink( $blog_page_id ) );109 $this->assertEquals( sprintf( 'blog-page – %s', $this->blog_name ), wp_get_document_title() );110 106 } 111 107
Note: See TracChangeset
for help on using the changeset viewer.