Changeset 35242 for trunk/tests/phpunit/tests/comment-submission.php
- Timestamp:
- 10/17/2015 06:02:16 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment-submission.php
r35225 r35242 39 39 $this->assertSame( 0, did_action( $error ) ); 40 40 41 $post = self:: $factory->post->create_and_get( array(41 $post = self::factory()->post->create_and_get( array( 42 42 'comment_status' => 'closed', 43 43 ) ); … … 59 59 $this->assertSame( 0, did_action( $error ) ); 60 60 61 $post = self:: $factory->post->create_and_get();61 $post = self::factory()->post->create_and_get(); 62 62 wp_trash_post( $post ); 63 63 $data = array( … … 78 78 $this->assertSame( 0, did_action( $error ) ); 79 79 80 $post = self:: $factory->post->create_and_get( array(80 $post = self::factory()->post->create_and_get( array( 81 81 'post_status' => 'draft', 82 82 ) ); … … 99 99 $this->assertSame( 0, did_action( $error ) ); 100 100 101 $post = self:: $factory->post->create_and_get( array(101 $post = self::factory()->post->create_and_get( array( 102 102 'post_date' => date( 'Y-m-d H:i:s', strtotime( '+1 day' ) ), 103 103 ) ); … … 122 122 $this->assertSame( 0, did_action( $error ) ); 123 123 124 $post = self:: $factory->post->create_and_get( array(124 $post = self::factory()->post->create_and_get( array( 125 125 'post_password' => 'password', 126 126 ) ); … … 143 143 $_COOKIE['wp-postpass_' . COOKIEHASH] = $hasher->HashPassword( $password ); 144 144 145 $post = self:: $factory->post->create_and_get( array(145 $post = self::factory()->post->create_and_get( array( 146 146 'post_password' => $password, 147 147 ) ); … … 163 163 public function test_submitting_valid_comment_as_logged_in_user_succeeds() { 164 164 165 $user = self:: $factory->user->create_and_get( array(165 $user = self::factory()->user->create_and_get( array( 166 166 'user_url' => 'http://user.example.org' 167 167 ) ); … … 169 169 wp_set_current_user( $user->ID ); 170 170 171 $post = self:: $factory->post->create_and_get();171 $post = self::factory()->post->create_and_get(); 172 172 $data = array( 173 173 'comment_post_ID' => $post->ID, … … 188 188 public function test_submitting_valid_comment_anonymously_succeeds() { 189 189 190 $post = self:: $factory->post->create_and_get();190 $post = self::factory()->post->create_and_get(); 191 191 $data = array( 192 192 'comment_post_ID' => $post->ID, … … 215 215 public function test_submitting_comment_handles_slashes_correctly_handles_slashes() { 216 216 217 $post = self:: $factory->post->create_and_get();217 $post = self::factory()->post->create_and_get(); 218 218 $data = array( 219 219 'comment_post_ID' => $post->ID, … … 237 237 $error = 'not_logged_in'; 238 238 239 $post = self:: $factory->post->create_and_get( array(239 $post = self::factory()->post->create_and_get( array( 240 240 'post_status' => 'private', 241 241 ) ); … … 253 253 public function test_submitting_comment_to_own_private_post_succeeds() { 254 254 255 $user = self:: $factory->user->create_and_get();256 257 wp_set_current_user( $user->ID ); 258 259 $post = self:: $factory->post->create_and_get( array(255 $user = self::factory()->user->create_and_get(); 256 257 wp_set_current_user( $user->ID ); 258 259 $post = self::factory()->post->create_and_get( array( 260 260 'post_status' => 'private', 261 261 'post_author' => $user->ID, … … 275 275 public function test_submitting_comment_to_accessible_private_post_succeeds() { 276 276 277 $author = self:: $factory->user->create_and_get( array(277 $author = self::factory()->user->create_and_get( array( 278 278 'role' => 'author', 279 279 ) ); 280 $user = self:: $factory->user->create_and_get( array(280 $user = self::factory()->user->create_and_get( array( 281 281 'role' => 'editor', 282 282 ) ); … … 284 284 wp_set_current_user( $user->ID ); 285 285 286 $post = self:: $factory->post->create_and_get( array(286 $post = self::factory()->post->create_and_get( array( 287 287 'post_status' => 'private', 288 288 'post_author' => $author->ID, … … 302 302 public function test_anonymous_user_cannot_comment_unfiltered_html() { 303 303 304 $post = self:: $factory->post->create_and_get();304 $post = self::factory()->post->create_and_get(); 305 305 $data = array( 306 306 'comment_post_ID' => $post->ID, … … 319 319 public function test_unprivileged_user_cannot_comment_unfiltered_html() { 320 320 321 $user = self:: $factory->user->create_and_get( array(321 $user = self::factory()->user->create_and_get( array( 322 322 'role' => 'author', 323 323 ) ); … … 326 326 $this->assertFalse( current_user_can( 'unfiltered_html' ) ); 327 327 328 $post = self:: $factory->post->create_and_get();328 $post = self::factory()->post->create_and_get(); 329 329 $data = array( 330 330 'comment_post_ID' => $post->ID, … … 341 341 public function test_unprivileged_user_cannot_comment_unfiltered_html_even_with_valid_nonce() { 342 342 343 $user = self:: $factory->user->create_and_get( array(343 $user = self::factory()->user->create_and_get( array( 344 344 'role' => 'author', 345 345 ) ); … … 348 348 $this->assertFalse( current_user_can( 'unfiltered_html' ) ); 349 349 350 $post = self:: $factory->post->create_and_get();350 $post = self::factory()->post->create_and_get(); 351 351 $action = 'unfiltered-html-comment_' . $post->ID; 352 352 $nonce = wp_create_nonce( $action ); … … 371 371 $this->assertFalse( defined( 'DISALLOW_UNFILTERED_HTML' ) ); 372 372 373 $user = self:: $factory->user->create_and_get( array(373 $user = self::factory()->user->create_and_get( array( 374 374 'role' => 'editor', 375 375 ) ); … … 385 385 $this->assertTrue( current_user_can( 'unfiltered_html' ) ); 386 386 387 $post = self:: $factory->post->create_and_get();387 $post = self::factory()->post->create_and_get(); 388 388 $action = 'unfiltered-html-comment_' . $post->ID; 389 389 $nonce = wp_create_nonce( $action ); … … 406 406 public function test_privileged_user_cannot_comment_unfiltered_html_without_valid_nonce() { 407 407 408 $user = self:: $factory->user->create_and_get( array(408 $user = self::factory()->user->create_and_get( array( 409 409 'role' => 'editor', 410 410 ) ); … … 420 420 $this->assertTrue( current_user_can( 'unfiltered_html' ) ); 421 421 422 $post = self:: $factory->post->create_and_get();422 $post = self::factory()->post->create_and_get(); 423 423 $data = array( 424 424 'comment_post_ID' => $post->ID, … … 440 440 update_option( 'comment_registration', '1' ); 441 441 442 $post = self:: $factory->post->create_and_get();442 $post = self::factory()->post->create_and_get(); 443 443 $data = array( 444 444 'comment_post_ID' => $post->ID, … … 460 460 update_option( 'require_name_email', '1' ); 461 461 462 $post = self:: $factory->post->create_and_get();462 $post = self::factory()->post->create_and_get(); 463 463 $data = array( 464 464 'comment_post_ID' => $post->ID, … … 482 482 update_option( 'require_name_email', '1' ); 483 483 484 $post = self:: $factory->post->create_and_get();484 $post = self::factory()->post->create_and_get(); 485 485 $data = array( 486 486 'comment_post_ID' => $post->ID, … … 504 504 update_option( 'require_name_email', '1' ); 505 505 506 $post = self:: $factory->post->create_and_get();506 $post = self::factory()->post->create_and_get(); 507 507 $data = array( 508 508 'comment_post_ID' => $post->ID, … … 524 524 $error = 'require_valid_comment'; 525 525 526 $post = self:: $factory->post->create_and_get();526 $post = self::factory()->post->create_and_get(); 527 527 $data = array( 528 528 'comment_post_ID' => $post->ID,
Note: See TracChangeset
for help on using the changeset viewer.