Changeset 7127 for trunk/tests/testcases/activity/template.php
- Timestamp:
- 05/29/2013 12:34:35 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/testcases/activity/template.php
r7107 r7127 138 138 $this->assertEquals( $ids, array( $a1 ) ); 139 139 } 140 141 /** 142 * @ticket BP5029 143 * @group bp_has_activities 144 */ 145 public function test_bp_has_activities_with_display_comments_false() { 146 $now = time(); 147 $a1 = $this->factory->activity->create( array( 148 'content' => 'Life Rules', 149 'recorded_time' => date( 'Y-m-d H:i:s', $now ), 150 ) ); 151 $a2 = $this->factory->activity->create( array( 152 'content' => 'Life Drools', 153 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ), 154 ) ); 155 $a3 = bp_activity_new_comment( array( 156 'activity_id' => $a1, 157 'content' => 'Candy is good', 158 'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ), 159 ) ); 160 161 global $activities_template; 162 bp_has_activities( array( 163 'display_comments' => false, 164 ) ); 165 $ids = wp_list_pluck( $activities_template->activities, 'id' ); 166 167 $this->assertEquals( array( $a1, $a2 ), wp_parse_id_list( $ids ) ); 168 169 } 170 171 /** 172 * @ticket BP5029 173 * @group bp_has_activities 174 */ 175 public function test_bp_has_activities_with_display_comments_0() { 176 $now = time(); 177 $a1 = $this->factory->activity->create( array( 178 'content' => 'Life Rules', 179 'recorded_time' => date( 'Y-m-d H:i:s', $now ), 180 ) ); 181 $a2 = $this->factory->activity->create( array( 182 'content' => 'Life Drools', 183 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ), 184 ) ); 185 $a3 = bp_activity_new_comment( array( 186 'activity_id' => $a1, 187 'content' => 'Candy is good', 188 'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ), 189 ) ); 190 191 global $activities_template; 192 bp_has_activities( array( 193 'display_comments' => 0, 194 ) ); 195 $ids = wp_list_pluck( $activities_template->activities, 'id' ); 196 197 $this->assertEquals( array( $a1, $a2 ), wp_parse_id_list( $ids ) ); 198 199 } 200 201 /** 202 * @ticket BP5029 203 * @group bp_has_activities 204 */ 205 public function test_bp_has_activities_with_display_comments_0_querystring() { 206 $now = time(); 207 $a1 = $this->factory->activity->create( array( 208 'content' => 'Life Rules', 209 'recorded_time' => date( 'Y-m-d H:i:s', $now ), 210 ) ); 211 $a2 = $this->factory->activity->create( array( 212 'content' => 'Life Drools', 213 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ), 214 ) ); 215 $a3 = bp_activity_new_comment( array( 216 'activity_id' => $a1, 217 'content' => 'Candy is good', 218 'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ), 219 ) ); 220 221 global $activities_template; 222 bp_has_activities( 'display_comments=0' ); 223 $ids = wp_list_pluck( $activities_template->activities, 'id' ); 224 225 $this->assertEquals( array( $a1, $a2 ), $ids ); 226 227 } 228 229 /** 230 * @ticket BP5029 231 * @group bp_has_activities 232 */ 233 public function test_bp_has_activities_with_display_comments_none_querystring() { 234 $now = time(); 235 $a1 = $this->factory->activity->create( array( 236 'content' => 'Life Rules', 237 'recorded_time' => date( 'Y-m-d H:i:s', $now ), 238 ) ); 239 $a2 = $this->factory->activity->create( array( 240 'content' => 'Life Drools', 241 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ), 242 ) ); 243 $a3 = bp_activity_new_comment( array( 244 'activity_id' => $a1, 245 'content' => 'Candy is good', 246 'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ), 247 ) ); 248 249 global $activities_template; 250 bp_has_activities( 'display_comments=none' ); 251 $ids = wp_list_pluck( $activities_template->activities, 'id' ); 252 253 $this->assertEquals( array( $a1, $a2 ), $ids ); 254 255 } 256 /** 257 * @ticket BP5029 258 */ 259 public function test_get_with_display_comments_false_querystring() { 260 $now = time(); 261 $a1 = $this->factory->activity->create( array( 262 'content' => 'Life Rules', 263 'recorded_time' => date( 'Y-m-d H:i:s', $now ), 264 ) ); 265 $a2 = $this->factory->activity->create( array( 266 'content' => 'Life Drools', 267 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ), 268 ) ); 269 $a3 = bp_activity_new_comment( array( 270 'activity_id' => $a1, 271 'content' => 'Candy is good', 272 'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ), 273 ) ); 274 275 $expected = BP_Activity_Activity::get( array( 276 'display_comments' => false, 277 ) ); 278 279 $found = BP_Activity_Activity::get( 'display_comments=false' ); 280 $this->assertEquals( $expected, $found ); 281 282 } 283 284 140 285 }
Note: See TracChangeset
for help on using the changeset viewer.