Changeset 36346 for trunk/tests/phpunit/tests/comment/query.php
- Timestamp:
- 01/19/2016 03:02:42 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/query.php
r36345 r36346 7 7 */ 8 8 class Tests_Comment_Query extends WP_UnitTestCase { 9 protected $post_id;9 protected static $post_id; 10 10 protected $comment_id; 11 12 public static function wpSetUpBeforeClass( $factory ) { 13 self::$post_id = $factory->post->create(); 14 } 15 16 public static function wpTearDownAfterClass() { 17 wp_delete_post( self::$post_id, true ); 18 } 11 19 12 20 function setUp() { 13 21 parent::setUp(); 14 15 $this->post_id = self::factory()->post->create();16 22 } 17 23 18 24 public function test_query() { 19 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );20 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );21 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );22 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );23 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );25 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 26 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 27 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 28 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 29 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 24 30 25 31 $q = new WP_Comment_Query(); … … 32 38 33 39 public function test_query_post_id_0() { 34 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );40 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 35 41 36 42 $q = new WP_Comment_Query(); … … 47 53 */ 48 54 public function test_query_type_empty_string() { 49 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );50 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );51 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );52 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );53 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );55 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 56 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 57 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 58 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 59 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 54 60 55 61 $q = new WP_Comment_Query(); … … 66 72 */ 67 73 public function test_query_type_comment() { 68 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );69 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );70 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );71 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );72 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );74 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 75 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 76 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 77 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 78 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 73 79 74 80 $q = new WP_Comment_Query(); … … 82 88 83 89 public function test_query_type_pingback() { 84 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );85 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );86 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );87 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );90 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 91 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 92 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 93 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 88 94 89 95 $q = new WP_Comment_Query(); … … 98 104 99 105 public function test_query_type_trackback() { 100 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );101 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );102 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );103 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );106 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 107 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 108 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 109 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 104 110 105 111 $q = new WP_Comment_Query(); … … 117 123 */ 118 124 public function test_query_type_pings() { 119 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );120 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );121 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );122 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );123 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );125 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 126 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 127 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 128 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 129 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 124 130 125 131 $q = new WP_Comment_Query(); … … 137 143 */ 138 144 public function test_type_array_comments_and_custom() { 139 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );140 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );141 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );142 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );143 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );144 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );145 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 146 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 147 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 148 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 149 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 150 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 145 151 146 152 $q = new WP_Comment_Query(); … … 157 163 */ 158 164 public function test_type_not__in_array_custom() { 159 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );160 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );161 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );162 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );163 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );164 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );165 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 166 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 167 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 168 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 169 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 170 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 165 171 166 172 $q = new WP_Comment_Query(); … … 177 183 */ 178 184 public function test_type__in_array_and_not_type_array_custom() { 179 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );180 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );181 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );182 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );183 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );184 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );185 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 186 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 187 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 188 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 189 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 190 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 185 191 186 192 $q = new WP_Comment_Query(); … … 198 204 */ 199 205 public function test_type_array_and_type__not_in_array_custom() { 200 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );201 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );202 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );203 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );204 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );205 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );206 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 207 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 208 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 209 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 210 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 211 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 206 212 207 213 $q = new WP_Comment_Query(); … … 219 225 */ 220 226 public function test_type__not_in_custom() { 221 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );222 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );223 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );224 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );225 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );226 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );227 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 228 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 229 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 230 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 231 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 232 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 227 233 228 234 $q = new WP_Comment_Query(); … … 239 245 */ 240 246 public function test_type_array_comments_and_pings() { 241 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );242 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );243 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );244 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );245 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );247 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 248 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 249 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 250 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 251 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 246 252 247 253 $q = new WP_Comment_Query(); … … 258 264 */ 259 265 public function test_type_array_comment_pings() { 260 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );261 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );262 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );266 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 267 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 268 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 263 269 264 270 $q = new WP_Comment_Query(); … … 275 281 */ 276 282 public function test_type_array_pingback() { 277 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );278 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );279 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );283 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 284 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 285 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 280 286 281 287 $q = new WP_Comment_Query(); … … 292 298 */ 293 299 public function test_type_array_custom_pingpack() { 294 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );295 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );296 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );300 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 301 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 302 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 297 303 298 304 $q = new WP_Comment_Query(); … … 309 315 */ 310 316 public function test_type_array_pings() { 311 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );312 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );313 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );317 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 318 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 319 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 314 320 315 321 $q = new WP_Comment_Query(); … … 326 332 */ 327 333 public function test_type_status_approved_array_comment_pings() { 328 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );329 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );330 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );331 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'pingback' ) );334 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 335 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 336 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 337 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0', 'comment_type' => 'pingback' ) ); 332 338 333 339 $q = new WP_Comment_Query(); … … 345 351 */ 346 352 public function test_type_array_trackback() { 347 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );348 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );349 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );353 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 354 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 355 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 350 356 351 357 $q = new WP_Comment_Query(); … … 362 368 */ 363 369 public function test_type_array_custom_trackback() { 364 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );365 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );366 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );370 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 371 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 372 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 367 373 368 374 $q = new WP_Comment_Query(); … … 379 385 */ 380 386 public function test_type_array_pings_approved() { 381 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );382 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );383 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );384 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'trackback' ) );387 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 388 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 389 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 390 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0', 'comment_type' => 'trackback' ) ); 385 391 386 392 $q = new WP_Comment_Query(); … … 398 404 */ 399 405 public function test_status_empty_string() { 400 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );401 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );402 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'spam' ) );406 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 407 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' ) ); 408 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'spam' ) ); 403 409 404 410 $q = new WP_Comment_Query(); … … 415 421 */ 416 422 public function test_status_hold() { 417 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );418 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );423 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 424 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' ) ); 419 425 420 426 $q = new WP_Comment_Query(); … … 431 437 */ 432 438 public function test_status_approve() { 433 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );434 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );439 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 440 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' ) ); 435 441 436 442 $q = new WP_Comment_Query(); … … 444 450 445 451 public function test_status_custom() { 446 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );447 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );448 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo1' ) );452 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 453 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo' ) ); 454 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo1' ) ); 449 455 450 456 $q = new WP_Comment_Query(); … … 458 464 459 465 public function test_status_all() { 460 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );461 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );462 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );466 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 467 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo' ) ); 468 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' ) ); 463 469 464 470 $q = new WP_Comment_Query(); … … 472 478 473 479 public function test_status_default_to_all() { 474 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );475 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );476 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );480 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 481 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo' ) ); 482 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' ) ); 477 483 478 484 $q = new WP_Comment_Query(); … … 488 494 */ 489 495 public function test_status_comma_any() { 490 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );491 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );492 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );496 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 497 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo' ) ); 498 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' ) ); 493 499 494 500 $q = new WP_Comment_Query(); … … 505 511 */ 506 512 public function test_status_comma_separated() { 507 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );508 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );509 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );513 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 514 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo' ) ); 515 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' ) ); 510 516 511 517 $q = new WP_Comment_Query(); … … 522 528 */ 523 529 public function test_status_array() { 524 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );525 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );526 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );530 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 531 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo' ) ); 532 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' ) ); 527 533 528 534 $q = new WP_Comment_Query(); … … 620 626 */ 621 627 function test_orderby_meta() { 622 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) );623 $comment_id2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) );624 $comment_id3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) );628 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); 629 $comment_id2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); 630 $comment_id3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); 625 631 626 632 add_comment_meta( $comment_id, 'key', 'value1', true ); … … 815 821 function test_get_comments_by_user() { 816 822 $users = self::factory()->user->create_many( 2 ); 817 self::factory()->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );818 self::factory()->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );819 self::factory()->comment->create( array( 'user_id' => $users[1], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );823 self::factory()->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 824 self::factory()->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 825 self::factory()->comment->create( array( 'user_id' => $users[1], 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 820 826 821 827 $comments = get_comments( array( … … 846 852 */ 847 853 public function test_get_comments_by_author_url() { 848 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) );849 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) );850 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar/baz' ) );854 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) ); 855 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) ); 856 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar/baz' ) ); 851 857 852 858 $comments = get_comments( array( … … 862 868 */ 863 869 function test_fields_ids_query() { 864 $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );865 $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );866 $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );870 $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 871 $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 872 $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 867 873 868 874 // Ensure we are dealing with integers, and not objects. … … 880 886 */ 881 887 function test_fields_comment__in() { 882 $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );883 $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );884 $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );888 $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 889 $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 890 $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 885 891 886 892 $comment_ids = get_comments( array( … … 896 902 */ 897 903 function test_fields_comment__not_in() { 898 $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );899 $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );900 $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );904 $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 905 $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 906 $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 901 907 902 908 $comment_ids = get_comments( array( … … 1042 1048 */ 1043 1049 public function test_get_comments_with_status_all() { 1044 $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1045 $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );1046 $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );1050 $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1051 $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 1052 $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '0' ) ); 1047 1053 $comments_approved_1 = get_comments( array( 'status' => 'all' ) ); 1048 1054 … … 1055 1061 */ 1056 1062 public function test_get_comments_with_include_unapproved_user_id() { 1057 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1058 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );1059 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );1060 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );1063 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1064 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 1065 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '0' ) ); 1066 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 6, 'comment_approved' => '0' ) ); 1061 1067 1062 1068 $found = get_comments( array( … … 1073 1079 */ 1074 1080 public function test_get_comments_with_include_unapproved_user_id_array() { 1075 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1076 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );1077 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );1078 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );1079 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );1081 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1082 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 1083 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '0' ) ); 1084 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 6, 'comment_approved' => '0' ) ); 1085 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 8, 'comment_approved' => '0' ) ); 1080 1086 1081 1087 $found = get_comments( array( … … 1092 1098 */ 1093 1099 public function test_get_comments_with_include_unapproved_user_id_comma_separated() { 1094 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1095 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );1096 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );1097 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );1098 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );1100 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1101 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 1102 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 1, 'comment_approved' => '0' ) ); 1103 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 6, 'comment_approved' => '0' ) ); 1104 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 8, 'comment_approved' => '0' ) ); 1099 1105 1100 1106 $found = get_comments( array( … … 1111 1117 */ 1112 1118 public function test_get_comments_with_include_unapproved_author_email() { 1113 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1114 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );1115 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );1116 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );1119 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1120 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) ); 1121 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) ); 1122 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) ); 1117 1123 1118 1124 $found = get_comments( array( … … 1129 1135 */ 1130 1136 public function test_get_comments_with_include_unapproved_mixed_array() { 1131 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1132 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );1133 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );1134 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );1135 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );1137 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1138 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) ); 1139 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) ); 1140 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) ); 1141 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) ); 1136 1142 1137 1143 $found = get_comments( array( … … 1148 1154 */ 1149 1155 public function test_get_comments_with_include_unapproved_mixed_comma_separated() { 1150 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1151 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );1152 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );1153 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );1154 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );1156 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1157 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) ); 1158 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) ); 1159 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) ); 1160 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) ); 1155 1161 1156 1162 $found = get_comments( array( … … 1164 1170 1165 1171 public function test_search() { 1166 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );1167 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'foo@example.com' ) );1168 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) );1169 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_author_IP' => 'foo.bar' ) );1170 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_content' => 'Nice foo comment' ) );1171 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com' ) );1172 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) ); 1173 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'foo@example.com' ) ); 1174 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) ); 1175 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_author_IP' => 'foo.bar' ) ); 1176 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_content' => 'Nice foo comment' ) ); 1177 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com' ) ); 1172 1178 1173 1179 $q = new WP_Comment_Query(); … … 1473 1479 $now = current_time( 'mysql', 1 ); 1474 1480 $comments = self::factory()->comment->create_many( 5, array( 1475 'comment_post_ID' => $this->post_id,1481 'comment_post_ID' => self::$post_id, 1476 1482 'comment_date_gmt' => $now, 1477 1483 ) ); … … 1493 1499 $now = current_time( 'mysql', 1 ); 1494 1500 $comments = self::factory()->comment->create_many( 5, array( 1495 'comment_post_ID' => $this->post_id,1501 'comment_post_ID' => self::$post_id, 1496 1502 'comment_date_gmt' => $now, 1497 1503 ) ); … … 1525 1531 1526 1532 public function test_count() { 1527 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );1528 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );1533 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7 ) ); 1534 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7 ) ); 1529 1535 1530 1536 $q = new WP_Comment_Query(); … … 1540 1546 */ 1541 1547 public function test_count_with_meta_query() { 1542 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );1543 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );1544 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );1548 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7 ) ); 1549 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7 ) ); 1550 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'user_id' => 7 ) ); 1545 1551 add_comment_meta( $c1, 'foo', 'bar' ); 1546 1552 add_comment_meta( $c3, 'foo', 'bar' ); … … 1798 1804 public function test_it_should_be_possible_to_modify_meta_query_using_pre_get_comments_action() { 1799 1805 $comments = self::factory()->comment->create_many( 2, array( 1800 'comment_post_ID' => $this->post_id,1806 'comment_post_ID' => self::$post_id, 1801 1807 ) ); 1802 1808 … … 1806 1812 1807 1813 $q = new WP_Comment_Query( array( 1808 'comment_post_ID' => $this->post_id,1814 'comment_post_ID' => self::$post_id, 1809 1815 'fields' => 'ids', 1810 1816 ) ); … … 1829 1835 public function test_it_should_be_possible_to_modify_meta_params_using_pre_get_comments_action() { 1830 1836 $comments = self::factory()->comment->create_many( 2, array( 1831 'comment_post_ID' => $this->post_id,1837 'comment_post_ID' => self::$post_id, 1832 1838 ) ); 1833 1839 … … 1837 1843 1838 1844 $q = new WP_Comment_Query( array( 1839 'comment_post_ID' => $this->post_id,1845 'comment_post_ID' => self::$post_id, 1840 1846 'fields' => 'ids', 1841 1847 ) ); … … 1855 1861 */ 1856 1862 public function test_parent__in() { 1857 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );1863 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 1858 1864 $c2 = self::factory()->comment->create( array( 1859 'comment_post_ID' => $this->post_id,1865 'comment_post_ID' => self::$post_id, 1860 1866 'comment_approved' => '1', 1861 1867 'comment_parent' => $c1, … … 1863 1869 1864 1870 $ids = new WP_Comment_Query( array( 1865 'comment_post_ID' => $this->post_id,1871 'comment_post_ID' => self::$post_id, 1866 1872 'fields' => 'ids', 1867 1873 'parent__in' => array( $c1 ) … … 1875 1881 */ 1876 1882 public function test_parent__in_commas() { 1877 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );1883 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 1878 1884 $c2 = self::factory()->comment->create( array( 1879 'comment_post_ID' => $this->post_id,1885 'comment_post_ID' => self::$post_id, 1880 1886 'comment_approved' => '1' 1881 1887 ) ); 1882 1888 $c3 = self::factory()->comment->create( array( 1883 'comment_post_ID' => $this->post_id,1889 'comment_post_ID' => self::$post_id, 1884 1890 'comment_approved' => '1', 1885 1891 'comment_parent' => $c1, 1886 1892 ) ); 1887 1893 $c4 = self::factory()->comment->create( array( 1888 'comment_post_ID' => $this->post_id,1894 'comment_post_ID' => self::$post_id, 1889 1895 'comment_approved' => '1', 1890 1896 'comment_parent' => $c2, … … 1892 1898 1893 1899 $ids = new WP_Comment_Query( array( 1894 'comment_post_ID' => $this->post_id,1900 'comment_post_ID' => self::$post_id, 1895 1901 'fields' => 'ids', 1896 1902 'parent__in' => "$c1,$c2" … … 1904 1910 */ 1905 1911 public function test_parent__not_in() { 1906 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );1912 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 1907 1913 1908 1914 self::factory()->comment->create( array( 1909 'comment_post_ID' => $this->post_id,1915 'comment_post_ID' => self::$post_id, 1910 1916 'comment_approved' => '1', 1911 1917 'comment_parent' => $c1, … … 1913 1919 1914 1920 $ids = new WP_Comment_Query( array( 1915 'comment_post_ID' => $this->post_id,1921 'comment_post_ID' => self::$post_id, 1916 1922 'fields' => 'ids', 1917 1923 'parent__not_in' => array( $c1 ) … … 1925 1931 */ 1926 1932 public function test_parent__not_in_commas() { 1927 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );1933 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 1928 1934 $c2 = self::factory()->comment->create( array( 1929 'comment_post_ID' => $this->post_id,1935 'comment_post_ID' => self::$post_id, 1930 1936 'comment_approved' => '1' 1931 1937 ) ); 1932 1938 1933 1939 self::factory()->comment->create( array( 1934 'comment_post_ID' => $this->post_id,1940 'comment_post_ID' => self::$post_id, 1935 1941 'comment_approved' => '1', 1936 1942 'comment_parent' => $c1, 1937 1943 ) ); 1938 1944 self::factory()->comment->create( array( 1939 'comment_post_ID' => $this->post_id,1945 'comment_post_ID' => self::$post_id, 1940 1946 'comment_approved' => '1', 1941 1947 'comment_parent' => $c2, … … 1943 1949 1944 1950 $ids = new WP_Comment_Query( array( 1945 'comment_post_ID' => $this->post_id,1951 'comment_post_ID' => self::$post_id, 1946 1952 'fields' => 'ids', 1947 1953 'parent__not_in' => "$c1,$c2" … … 1956 1962 public function test_orderby_comment__in() { 1957 1963 self::factory()->comment->create( array( 1958 'comment_post_ID' => $this->post_id,1964 'comment_post_ID' => self::$post_id, 1959 1965 'comment_approved' => '1' 1960 1966 ) ); 1961 1967 1962 1968 $c2 = self::factory()->comment->create( array( 1963 'comment_post_ID' => $this->post_id,1969 'comment_post_ID' => self::$post_id, 1964 1970 'comment_approved' => '1' 1965 1971 ) ); 1966 1972 $c3 = self::factory()->comment->create( array( 1967 'comment_post_ID' => $this->post_id,1973 'comment_post_ID' => self::$post_id, 1968 1974 'comment_approved' => '1' 1969 1975 ) ); 1970 1976 1971 1977 self::factory()->comment->create( array( 1972 'comment_post_ID' => $this->post_id,1978 'comment_post_ID' => self::$post_id, 1973 1979 'comment_approved' => '1' 1974 1980 ) ); … … 1989 1995 */ 1990 1996 public function test_no_found_rows_should_default_to_true() { 1991 $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );1997 $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => self::$post_id ) ); 1992 1998 1993 1999 $q = new WP_Comment_Query( array( 1994 'post_id' => $this->post_id,2000 'post_id' => self::$post_id, 1995 2001 'number' => 2, 1996 2002 ) ); … … 2004 2010 */ 2005 2011 public function test_should_respect_no_found_rows_true() { 2006 $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );2012 $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => self::$post_id ) ); 2007 2013 2008 2014 $q = new WP_Comment_Query( array( 2009 'post_id' => $this->post_id,2015 'post_id' => self::$post_id, 2010 2016 'number' => 2, 2011 2017 'no_found_rows' => true, … … 2020 2026 */ 2021 2027 public function test_should_respect_no_found_rows_false() { 2022 $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );2028 $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => self::$post_id ) ); 2023 2029 2024 2030 $q = new WP_Comment_Query( array( 2025 'post_id' => $this->post_id,2031 'post_id' => self::$post_id, 2026 2032 'number' => 2, 2027 2033 'no_found_rows' => false, … … 2037 2043 public function test_hierarchical_should_skip_child_comments_in_offset() { 2038 2044 $top_level_0 = self::factory()->comment->create( array( 2039 'comment_post_ID' => $this->post_id,2045 'comment_post_ID' => self::$post_id, 2040 2046 'comment_approved' => '1', 2041 2047 ) ); 2042 2048 2043 2049 $child_of_0 = self::factory()->comment->create( array( 2044 'comment_post_ID' => $this->post_id,2050 'comment_post_ID' => self::$post_id, 2045 2051 'comment_approved' => '1', 2046 2052 'comment_parent' => $top_level_0, … … 2048 2054 2049 2055 $top_level_comments = self::factory()->comment->create_many( 3, array( 2050 'comment_post_ID' => $this->post_id,2056 'comment_post_ID' => self::$post_id, 2051 2057 'comment_approved' => '1', 2052 2058 ) ); 2053 2059 2054 2060 $q = new WP_Comment_Query( array( 2055 'post_id' => $this->post_id,2061 'post_id' => self::$post_id, 2056 2062 'hierarchical' => 'flat', 2057 2063 'number' => 2, … … 2070 2076 public function test_hierarchical_should_not_include_child_comments_in_number() { 2071 2077 $top_level_0 = self::factory()->comment->create( array( 2072 'comment_post_ID' => $this->post_id,2078 'comment_post_ID' => self::$post_id, 2073 2079 'comment_approved' => '1', 2074 2080 ) ); 2075 2081 2076 2082 $child_of_0 = self::factory()->comment->create( array( 2077 'comment_post_ID' => $this->post_id,2083 'comment_post_ID' => self::$post_id, 2078 2084 'comment_approved' => '1', 2079 2085 'comment_parent' => $top_level_0, … … 2081 2087 2082 2088 $top_level_comments = self::factory()->comment->create_many( 3, array( 2083 'comment_post_ID' => $this->post_id,2089 'comment_post_ID' => self::$post_id, 2084 2090 'comment_approved' => '1', 2085 2091 ) ); 2086 2092 2087 2093 $q = new WP_Comment_Query( array( 2088 'post_id' => $this->post_id,2094 'post_id' => self::$post_id, 2089 2095 'hierarchical' => 'flat', 2090 2096 'number' => 2, … … 2101 2107 public function test_hierarchical_threaded() { 2102 2108 $c1 = self::factory()->comment->create( array( 2103 'comment_post_ID' => $this->post_id,2109 'comment_post_ID' => self::$post_id, 2104 2110 'comment_approved' => '1', 2105 2111 ) ); 2106 2112 2107 2113 $c2 = self::factory()->comment->create( array( 2108 'comment_post_ID' => $this->post_id,2114 'comment_post_ID' => self::$post_id, 2109 2115 'comment_approved' => '1', 2110 2116 'comment_parent' => $c1, … … 2112 2118 2113 2119 $c3 = self::factory()->comment->create( array( 2114 'comment_post_ID' => $this->post_id,2120 'comment_post_ID' => self::$post_id, 2115 2121 'comment_approved' => '1', 2116 2122 'comment_parent' => $c2, … … 2118 2124 2119 2125 $c4 = self::factory()->comment->create( array( 2120 'comment_post_ID' => $this->post_id,2126 'comment_post_ID' => self::$post_id, 2121 2127 'comment_approved' => '1', 2122 2128 'comment_parent' => $c1, … … 2124 2130 2125 2131 $c5 = self::factory()->comment->create( array( 2126 'comment_post_ID' => $this->post_id,2132 'comment_post_ID' => self::$post_id, 2127 2133 'comment_approved' => '1', 2128 2134 ) ); 2129 2135 2130 2136 $c6 = self::factory()->comment->create( array( 2131 'comment_post_ID' => $this->post_id,2137 'comment_post_ID' => self::$post_id, 2132 2138 'comment_approved' => '1', 2133 2139 'comment_parent' => $c5, … … 2141 2147 2142 2148 $query_args = array_merge( $args, array( 2143 'post_id' => $this->post_id,2149 'post_id' => self::$post_id, 2144 2150 ) ); 2145 2151 … … 2164 2170 public function test_hierarchical_threaded_approved() { 2165 2171 $c1 = self::factory()->comment->create( array( 2166 'comment_post_ID' => $this->post_id,2172 'comment_post_ID' => self::$post_id, 2167 2173 'comment_approved' => '1', 2168 2174 ) ); 2169 2175 2170 2176 $c2 = self::factory()->comment->create( array( 2171 'comment_post_ID' => $this->post_id,2177 'comment_post_ID' => self::$post_id, 2172 2178 'comment_approved' => '1', 2173 2179 'comment_parent' => $c1, … … 2175 2181 2176 2182 $c3 = self::factory()->comment->create( array( 2177 'comment_post_ID' => $this->post_id,2183 'comment_post_ID' => self::$post_id, 2178 2184 'comment_approved' => '0', 2179 2185 'comment_parent' => $c2, … … 2181 2187 2182 2188 $c4 = self::factory()->comment->create( array( 2183 'comment_post_ID' => $this->post_id,2189 'comment_post_ID' => self::$post_id, 2184 2190 'comment_approved' => '1', 2185 2191 'comment_parent' => $c1, … … 2187 2193 2188 2194 $c5 = self::factory()->comment->create( array( 2189 'comment_post_ID' => $this->post_id,2195 'comment_post_ID' => self::$post_id, 2190 2196 'comment_approved' => '1', 2191 2197 ) ); 2192 2198 2193 2199 self::factory()->comment->create( array( 2194 'comment_post_ID' => $this->post_id,2200 'comment_post_ID' => self::$post_id, 2195 2201 'comment_approved' => '1', 2196 2202 'comment_parent' => $c5, … … 2205 2211 2206 2212 $query_args = array_merge( $args, array( 2207 'post_id' => $this->post_id,2213 'post_id' => self::$post_id, 2208 2214 ) ); 2209 2215 … … 2225 2231 public function test_comment_clauses_prepend_callback_should_be_respected_when_filling_descendants() { 2226 2232 $top_level_0 = self::factory()->comment->create( array( 2227 'comment_post_ID' => $this->post_id,2233 'comment_post_ID' => self::$post_id, 2228 2234 'comment_approved' => '1', 2229 2235 ) ); 2230 2236 2231 2237 $child1_of_0 = self::factory()->comment->create( array( 2232 'comment_post_ID' => $this->post_id,2238 'comment_post_ID' => self::$post_id, 2233 2239 'comment_approved' => '1', 2234 2240 'comment_parent' => $top_level_0, … … 2236 2242 2237 2243 $child2_of_0 = self::factory()->comment->create( array( 2238 'comment_post_ID' => $this->post_id,2244 'comment_post_ID' => self::$post_id, 2239 2245 'comment_approved' => '1', 2240 2246 'comment_parent' => $top_level_0, … … 2242 2248 2243 2249 $top_level_comments = self::factory()->comment->create_many( 3, array( 2244 'comment_post_ID' => $this->post_id,2250 'comment_post_ID' => self::$post_id, 2245 2251 'comment_approved' => '1', 2246 2252 ) ); … … 2250 2256 add_filter( 'comments_clauses', array( $this, 'prepend_exclusions' ) ); 2251 2257 $q = new WP_Comment_Query( array( 2252 'post_id' => $this->post_id,2258 'post_id' => self::$post_id, 2253 2259 'hierarchical' => 'flat', 2254 2260 ) ); … … 2271 2277 public function test_comment_clauses_append_callback_should_be_respected_when_filling_descendants() { 2272 2278 $top_level_0 = self::factory()->comment->create( array( 2273 'comment_post_ID' => $this->post_id,2279 'comment_post_ID' => self::$post_id, 2274 2280 'comment_approved' => '1', 2275 2281 ) ); 2276 2282 2277 2283 $child1_of_0 = self::factory()->comment->create( array( 2278 'comment_post_ID' => $this->post_id,2284 'comment_post_ID' => self::$post_id, 2279 2285 'comment_approved' => '1', 2280 2286 'comment_parent' => $top_level_0, … … 2282 2288 2283 2289 $child2_of_0 = self::factory()->comment->create( array( 2284 'comment_post_ID' => $this->post_id,2290 'comment_post_ID' => self::$post_id, 2285 2291 'comment_approved' => '1', 2286 2292 'comment_parent' => $top_level_0, … … 2288 2294 2289 2295 $top_level_comments = self::factory()->comment->create_many( 3, array( 2290 'comment_post_ID' => $this->post_id,2296 'comment_post_ID' => self::$post_id, 2291 2297 'comment_approved' => '1', 2292 2298 ) ); … … 2296 2302 add_filter( 'comments_clauses', array( $this, 'append_exclusions' ) ); 2297 2303 $q = new WP_Comment_Query( array( 2298 'post_id' => $this->post_id,2304 'post_id' => self::$post_id, 2299 2305 'hierarchical' => 'flat', 2300 2306 ) ); … … 2354 2360 global $wpdb; 2355 2361 2356 $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );2362 $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => self::$post_id ) ); 2357 2363 clean_comment_cache( $comments ); 2358 2364 2359 2365 $num_queries = $wpdb->num_queries; 2360 2366 $q = new WP_Comment_Query( array( 2361 'post_id' => $this->post_id,2367 'post_id' => self::$post_id, 2362 2368 'no_found_rows' => true, 2363 2369 'update_comment_post_cache' => false, … … 2381 2387 wp_suspend_cache_addition( true ); 2382 2388 2383 $c = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) );2389 $c = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); 2384 2390 2385 2391 $q = new WP_Comment_Query( array( 2386 'post_id' => $this->post_id,2392 'post_id' => self::$post_id, 2387 2393 ) ); 2388 2394
Note: See TracChangeset
for help on using the changeset viewer.