Changeset 54488 for trunk/tests/phpunit/tests/comment/commentForm.php
- Timestamp:
- 10/11/2022 03:43:04 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/commentForm.php
r53863 r54488 154 154 $this->assertStringNotContainsString( $expected, $form ); 155 155 } 156 157 /** 158 * @ticket 56243 159 */ 160 public function test_comment_form_should_not_display_for_global_post_when_called_with_invalid_id() { 161 // Go to permalink to ensure global post ID is set. 162 $this->go_to( get_permalink( self::$post_id ) ); 163 164 $impossibly_high_post_id = PHP_INT_MAX; 165 166 $form = get_echo( 'comment_form', array( array(), $impossibly_high_post_id ) ); 167 $this->assertEmpty( $form ); 168 } 169 170 /** 171 * @ticket 56243 172 */ 173 public function test_comment_form_should_display_for_global_post_with_falsey_post_id() { 174 $post_id = self::$post_id; 175 $this->go_to( get_permalink( $post_id ) ); 176 177 $form = get_echo( 'comment_form', array( array(), false ) ); 178 $this->assertNotEmpty( $form ); 179 180 $post_hidden_field = "<input type='hidden' name='comment_post_ID' value='{$post_id}' id='comment_post_ID' />"; 181 $this->assertStringContainsString( $post_hidden_field, $form ); 182 } 183 184 /** 185 * @ticket 56243 186 */ 187 public function test_comment_form_should_display_for_specified_post_when_passed_a_valid_post_id() { 188 $post_id = self::$post_id; 189 190 $form = get_echo( 'comment_form', array( array(), $post_id ) ); 191 $this->assertNotEmpty( $form ); 192 193 $post_hidden_field = "<input type='hidden' name='comment_post_ID' value='{$post_id}' id='comment_post_ID' />"; 194 $this->assertStringContainsString( $post_hidden_field, $form ); 195 } 156 196 }
Note: See TracChangeset
for help on using the changeset viewer.