Changeset 35311 for trunk/tests/phpunit/tests/ajax/GetComments.php
- Timestamp:
- 10/21/2015 03:17:36 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/GetComments.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 $_no_comment_post = null;28 protected static $no_comment_post = null; 29 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 ); 30 protected static $comment_ids = array(); 38 31 39 $post_id = self::factory()->post->create(); 40 $this->_no_comment_post = get_post( $post_id ); 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::$no_comment_post = $factory->post->create_and_get(); 36 } 41 37 42 unset( $GLOBALS['post_id'] ); 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::$no_comment_post->ID, true ); 43 45 } 44 46 … … 56 58 $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' ); 57 59 $_POST['action'] = 'get-comments'; 58 $_POST['p'] = $this->_comment_post->ID;60 $_POST['p'] = self::$comment_post->ID; 59 61 60 62 // Make the request … … 93 95 $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' ); 94 96 $_POST['action'] = 'get-comments'; 95 $_POST['p'] = $this->_comment_post->ID;97 $_POST['p'] = self::$comment_post->ID; 96 98 97 99 // Make the request … … 113 115 $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() ); 114 116 $_POST['action'] = 'get-comments'; 115 $_POST['p'] = $this->_comment_post->ID;117 $_POST['p'] = self::$comment_post->ID; 116 118 117 119 // Make the request … … 153 155 $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' ); 154 156 $_POST['action'] = 'get-comments'; 155 $_POST['p'] = $this->_no_comment_post->ID;157 $_POST['p'] = self::$no_comment_post->ID; 156 158 157 159 // Make the request
Note: See TracChangeset
for help on using the changeset viewer.