Changeset 49268 for trunk/tests/phpunit/tests/xmlrpc/wp/newComment.php
- Timestamp:
- 10/22/2020 12:17:10 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/xmlrpc/wp/newComment.php
r48937 r49268 6 6 class Tests_XMLRPC_wp_newComment extends WP_XMLRPC_UnitTestCase { 7 7 8 /** 9 * Post object for shared fixture. 10 * 11 * @var WP_Post 12 */ 13 public static $post; 14 15 public static function wpSetUpBeforeClass( $factory ) { 16 self::make_user_by_role( 'administrator' ); 17 self::$post = $factory->post->create_and_get(); 18 } 19 8 20 function test_valid_comment() { 9 $this->make_user_by_role( 'administrator' );10 $post = self::factory()->post->create_and_get();11 12 21 $result = $this->myxmlrpcserver->wp_newComment( 13 22 array( … … 15 24 'administrator', 16 25 'administrator', 17 $post->ID,26 self::$post->ID, 18 27 array( 19 28 'content' => rand_str( 100 ), … … 26 35 27 36 function test_empty_comment() { 28 $this->make_user_by_role( 'administrator' );29 $post = self::factory()->post->create_and_get();30 31 37 $result = $this->myxmlrpcserver->wp_newComment( 32 38 array( … … 34 40 'administrator', 35 41 'administrator', 36 $post->ID,42 self::$post->ID, 37 43 array( 38 44 'content' => '', … … 46 52 47 53 function test_new_comment_post_closed() { 48 $this->make_user_by_role( 'administrator' );49 54 $post = self::factory()->post->create_and_get( 50 55 array( … … 72 77 73 78 function test_new_comment_duplicated() { 74 $this->make_user_by_role( 'administrator' );75 $post = self::factory()->post->create_and_get();76 77 79 $comment_args = array( 78 80 1, 79 81 'administrator', 80 82 'administrator', 81 $post->ID,83 self::$post->ID, 82 84 array( 83 85 'content' => rand_str( 100 ), … … 95 97 $this->assertSame( 403, $result->code ); 96 98 } 97 98 99 }
Note: See TracChangeset
for help on using the changeset viewer.