| 1281 | * @group bp_activity_delete_comment |
| 1282 | * @ticket BP7450 |
| 1283 | */ |
| 1284 | public function test_bp_activity_delete_comment_shouldnt_delete_all_comments_when_parameters_are_empty() { |
| 1285 | $u = $this->factory->user->create(); |
| 1286 | |
| 1287 | // create an activity update |
| 1288 | $parent_activity = $this->factory->activity->create( array( |
| 1289 | 'type' => 'activity_update', |
| 1290 | 'user_id' => $u |
| 1291 | ) ); |
| 1292 | |
| 1293 | // create some activity comments |
| 1294 | $comment_one = bp_activity_new_comment( array( |
| 1295 | 'user_id' => $u, |
| 1296 | 'activity_id' => $parent_activity, |
| 1297 | 'content' => 'depth 1' |
| 1298 | ) ); |
| 1299 | |
| 1300 | $comment_one_one = bp_activity_new_comment( array( |
| 1301 | 'user_id' => $u, |
| 1302 | 'activity_id' => $parent_activity, |
| 1303 | 'parent_id' => $comment_one, |
| 1304 | 'content' => 'depth 2' |
| 1305 | ) ); |
| 1306 | |
| 1307 | $comment_two = bp_activity_new_comment( array( |
| 1308 | 'user_id' => $u, |
| 1309 | 'activity_id' => $parent_activity, |
| 1310 | 'content' => 'depth 1' |
| 1311 | ) ); |
| 1312 | |
| 1313 | // Pass empty values to bp_activity_delete_comment() |
| 1314 | $retval = bp_activity_delete_comment( 0, 0 ); |
| 1315 | $this->assertFalse( $retval ); |
| 1316 | |
| 1317 | // Instantiate activity loop, which also includes activity comments. |
| 1318 | bp_has_activities( 'display_comments=stream' ); |
| 1319 | |
| 1320 | // Activity comments should not be deleted. |
| 1321 | $this->assertSame( 4, $GLOBALS['activities_template']->activity_count ); |
| 1322 | |
| 1323 | // Clean up after ourselves! |
| 1324 | $GLOBALS['activities_template'] = null; |
| 1325 | } |
| 1326 | |
| 1327 | /** |