Changeset 38951 for trunk/tests/phpunit/tests/post/getBodyClass.php
- Timestamp:
- 10/26/2016 08:06:43 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/getBodyClass.php
r37249 r38951 93 93 } 94 94 95 public function test_page_template_body_classes_no_template() { 96 $post_id = self::factory()->post->create( array( 97 'post_type' => 'page', 98 ) ); 99 $this->go_to( get_permalink( $post_id ) ); 100 101 $class = get_body_class(); 102 103 $this->assertNotContains( 'page-template', $class ); 104 $this->assertContains( 'page-template-default', $class ); 105 } 106 107 public function test_page_template_body_classes() { 108 $post_id = self::factory()->post->create( array( 109 'post_type' => 'page', 110 ) ); 111 112 add_post_meta( $post_id, '_wp_page_template', 'templates/cpt.php' ); 113 114 $this->go_to( get_permalink( $post_id ) ); 115 116 $class = get_body_class(); 117 118 $this->assertContains( 'page-template', $class ); 119 $this->assertContains( 'page-template-templates', $class ); 120 $this->assertContains( 'page-template-cpt', $class ); 121 $this->assertContains( 'page-template-templatescpt-php', $class ); 122 } 123 124 /** 125 * @ticket 18375 126 */ 127 public function test_page_template_body_classes_attachment() { 128 $post_id = self::factory()->post->create( array( 129 'post_type' => 'attachment', 130 ) ); 131 132 add_post_meta( $post_id, '_wp_page_template', 'templates/cpt.php' ); 133 134 $this->go_to( get_permalink( $post_id ) ); 135 136 $class = get_body_class(); 137 138 $this->assertContains( 'attachment-template', $class ); 139 $this->assertContains( 'attachment-template-templates', $class ); 140 $this->assertContains( 'attachment-template-cpt', $class ); 141 $this->assertContains( 'attachment-template-templatescpt-php', $class ); 142 } 143 144 /** 145 * @ticket 18375 146 */ 147 public function test_page_template_body_classes_post() { 148 $post_id = self::factory()->post->create(); 149 150 add_post_meta( $post_id, '_wp_page_template', 'templates/cpt.php' ); 151 152 $this->go_to( get_permalink( $post_id ) ); 153 154 $class = get_body_class(); 155 156 $this->assertContains( 'post-template', $class ); 157 $this->assertContains( 'post-template-templates', $class ); 158 $this->assertContains( 'post-template-cpt', $class ); 159 $this->assertContains( 'post-template-templatescpt-php', $class ); 160 } 95 161 }
Note: See TracChangeset
for help on using the changeset viewer.