Changeset 39045 for trunk/tests/phpunit/tests/xmlrpc/wp/newComment.php
- Timestamp:
- 10/31/2016 01:26:10 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/xmlrpc/wp/newComment.php
r38950 r39045 5 5 */ 6 6 class Tests_XMLRPC_wp_newComment extends WP_XMLRPC_UnitTestCase { 7 8 function test_valid_comment() { 9 $this->make_user_by_role( 'administrator' ); 10 $post = self::factory()->post->create_and_get(); 11 12 $result = $this->myxmlrpcserver->wp_newComment( array( 1, 'administrator', 'administrator', $post->ID, array( 13 'content' => rand_str( 100 ) 14 ) ) ); 15 16 $this->assertNotInstanceOf( 'IXR_Error', $result ); 17 } 18 19 function test_empty_comment() { 20 $this->make_user_by_role( 'administrator' ); 21 $post = self::factory()->post->create_and_get(); 22 23 $result = $this->myxmlrpcserver->wp_newComment( array( 1, 'administrator', 'administrator', $post->ID, array( 24 'content' => '' 25 ) ) ); 26 27 $this->assertInstanceOf( 'IXR_Error', $result ); 28 $this->assertEquals( 403, $result->code ); 29 } 30 7 31 function test_new_comment_post_closed() { 8 32 $this->make_user_by_role( 'administrator' ); … … 20 44 $this->assertEquals( 403, $result->code ); 21 45 } 46 47 function test_new_comment_duplicated() { 48 $this->make_user_by_role( 'administrator' ); 49 $post = self::factory()->post->create_and_get(); 50 51 $comment_args = array( 1, 'administrator', 'administrator', $post->ID, array( 52 'content' => rand_str( 100 ), 53 ) ); 54 55 // First time it's a valid comment 56 $result = $this->myxmlrpcserver->wp_newComment( $comment_args ); 57 $this->assertNotInstanceOf( 'IXR_Error', $result ); 58 59 // Run second time for duplication error 60 $result = $this->myxmlrpcserver->wp_newComment( $comment_args ); 61 62 $this->assertInstanceOf( 'IXR_Error', $result ); 63 $this->assertEquals( 403, $result->code ); 64 } 65 22 66 }
Note: See TracChangeset
for help on using the changeset viewer.