Changeset 35311 for trunk/tests/phpunit/tests/ajax/ReplytoComment.php
- Timestamp:
- 10/21/2015 03:17:36 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/ReplytoComment.php
r35242 r35311 20 20 * @var mixed 21 21 */ 22 protected $_comment_post = null;22 protected static $comment_post = null; 23 23 24 24 /** … … 26 26 * @var mixed 27 27 */ 28 protected $_draft_post = null; 29 30 /** 31 * Set up the test fixture 32 */ 33 public function setUp() { 34 parent::setUp(); 35 $post_id = self::factory()->post->create(); 36 self::factory()->comment->create_post_comments( $post_id, 5 ); 37 $this->_comment_post = get_post( $post_id ); 38 39 $post_id = self::factory()->post->create( array( 'post_status' => 'draft' ) ); 40 $this->_draft_post = get_post( $post_id ); 28 protected static $draft_post = null; 29 30 protected static $comment_ids = array(); 31 32 public static function wpSetUpBeforeClass( $factory ) { 33 self::$comment_post = $factory->post->create_and_get(); 34 self::$comment_ids = $factory->comment->create_post_comments( self::$comment_post->ID, 5 ); 35 self::$draft_post = $factory->post->create_and_get( array( 'post_status' => 'draft' ) ); 36 } 37 38 public static function wpTearDownAfterClass() { 39 foreach ( self::$comment_ids as $comment_id ) { 40 wp_delete_comment( $comment_id, true ); 41 } 42 43 wp_delete_post( self::$comment_post->ID, true ); 44 wp_delete_post( self::$draft_post->ID, true ); 41 45 } 42 46 … … 58 62 // Get a comment 59 63 $comments = get_comments( array( 60 'post_id' => $this->_comment_post->ID64 'post_id' => self::$comment_post->ID 61 65 ) ); 62 66 $comment = array_pop( $comments ); … … 66 70 $_POST['comment_ID'] = $comment->comment_ID; 67 71 $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; 68 $_POST['comment_post_ID'] = $this->_comment_post->ID;72 $_POST['comment_post_ID'] = self::$comment_post->ID; 69 73 70 74 // Make the request … … 102 106 // Get a comment 103 107 $comments = get_comments( array( 104 'post_id' => $this->_comment_post->ID108 'post_id' => self::$comment_post->ID 105 109 ) ); 106 110 $comment = array_pop( $comments ); … … 110 114 $_POST['comment_ID'] = $comment->comment_ID; 111 115 $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; 112 $_POST['comment_post_ID'] = $this->_comment_post->ID;116 $_POST['comment_post_ID'] = self::$comment_post->ID; 113 117 114 118 // Make the request … … 129 133 // Get a comment 130 134 $comments = get_comments( array( 131 'post_id' => $this->_comment_post->ID135 'post_id' => self::$comment_post->ID 132 136 ) ); 133 137 $comment = array_pop( $comments ); … … 137 141 $_POST['comment_ID'] = $comment->comment_ID; 138 142 $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; 139 $_POST['comment_post_ID'] = $this->_comment_post->ID;143 $_POST['comment_post_ID'] = self::$comment_post->ID; 140 144 141 145 // Make the request … … 177 181 $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' ); 178 182 $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; 179 $_POST['comment_post_ID'] = $this->_draft_post->ID;183 $_POST['comment_post_ID'] = self::$draft_post->ID; 180 184 181 185 // Make the request … … 199 203 $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' ); 200 204 $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; 201 $_POST['comment_post_ID'] = $this->_comment_post->ID;205 $_POST['comment_post_ID'] = self::$comment_post->ID; 202 206 203 207 // Block comments from being saved, simulate a DB error
Note: See TracChangeset
for help on using the changeset viewer.