| 756 | /** |
| 757 | * @group activity_action |
| 758 | * @group bp_activity_format_activity_action_activity_comment |
| 759 | * @ticket BP8120 |
| 760 | */ |
| 761 | public function test_bp_activity_format_activity_action_children_activity_comment() { |
| 762 | $u = self::factory()->user->create(); |
| 763 | $a1 = self::factory()->activity->create( array( |
| 764 | 'component' => buddypress()->activity->id, |
| 765 | 'type' => 'activity_update', |
| 766 | 'user_id' => $u, |
| 767 | ) ); |
| 768 | |
| 769 | $ac1 = self::factory()->activity->create( array( |
| 770 | 'type' => 'activity_comment', |
| 771 | 'item_id' => $a1, |
| 772 | 'secondary_item_id' => $a1, |
| 773 | 'user_id' => $u, |
| 774 | ) ); |
| 775 | |
| 776 | $ac2 = self::factory()->activity->create( array( |
| 777 | 'type' => 'activity_comment', |
| 778 | 'item_id' => $a1, |
| 779 | 'secondary_item_id' => $ac1, |
| 780 | 'user_id' => $u, |
| 781 | ) ); |
| 782 | |
| 783 | // Remove all action strings |
| 784 | $table = buddypress()->activity->table_name; |
| 785 | $GLOBALS['wpdb']->query( "UPDATE {$table} set action = '' WHERE id IN ( {$a1}, {$ac1}, {$ac2} )" ); |
| 786 | |
| 787 | $get = bp_activity_get( array( |
| 788 | 'in' => array( $a1 ), |
| 789 | 'display_comments' => 'thread' |
| 790 | ) ); |
| 791 | |
| 792 | $activity = reset( $get['activities'] ); |
| 793 | $comment_one = reset( $activity->children ); |
| 794 | $comment_two = reset( $comment_one->children ); |
| 795 | $user_link = bp_core_get_userlink( $u ); |
| 796 | |
| 797 | $this->assertSame( sprintf( '%s posted a new activity comment', $user_link ), $comment_one->action ); |
| 798 | $this->assertSame( sprintf( '%s posted a new activity comment', $user_link ), $comment_two->action ); |
| 799 | } |
| 800 | |