| | 446 | * @group get_recorded_components |
| | 447 | */ |
| | 448 | public function test_get_recorded_components_skip_last_activity_false() { |
| | 449 | $a1 = $this->factory->activity->create( array( |
| | 450 | 'component' => 'members', |
| | 451 | 'action' => 'last_activity', |
| | 452 | ) ); |
| | 453 | $a2 = $this->factory->activity->create( array( |
| | 454 | 'component' => 'groups', |
| | 455 | 'action' => 'created_group', |
| | 456 | ) ); |
| | 457 | $a3 = $this->factory->activity->create( array( |
| | 458 | 'component' => 'friends', |
| | 459 | 'action' => 'friendship_accepted', |
| | 460 | ) ); |
| | 461 | |
| | 462 | $found = BP_Activity_Activity::get_recorded_components( false ); |
| | 463 | sort( $found ); |
| | 464 | |
| | 465 | $this->assertSame( array( 'friends', 'groups', 'members' ), BP_Activity_Activity::get_recorded_components( false ) ); |
| | 466 | } |
| | 467 | |
| | 468 | /** |
| | 469 | * @group get_recorded_components |
| | 470 | */ |
| | 471 | public function test_get_recorded_components_skip_last_activity_true_filter_empty_component() { |
| | 472 | $a1 = $this->factory->activity->create( array( |
| | 473 | 'component' => 'members', |
| | 474 | 'action' => 'last_activity', |
| | 475 | ) ); |
| | 476 | $a2 = $this->factory->activity->create( array( |
| | 477 | 'component' => 'groups', |
| | 478 | 'action' => 'created_group', |
| | 479 | ) ); |
| | 480 | $a3 = $this->factory->activity->create( array( |
| | 481 | 'component' => 'friends', |
| | 482 | 'action' => 'friendship_accepted', |
| | 483 | ) ); |
| | 484 | |
| | 485 | $found = BP_Activity_Activity::get_recorded_components( true ); |
| | 486 | sort( $found ); |
| | 487 | |
| | 488 | $this->assertSame( array( 'friends', 'groups' ), BP_Activity_Activity::get_recorded_components() ); |
| | 489 | } |
| | 490 | |
| | 491 | /** |
| | 492 | * @group get_recorded_components |
| | 493 | */ |
| | 494 | public function test_get_recorded_components_skip_last_activity_true_members_component_not_empty() { |
| | 495 | $a1 = $this->factory->activity->create( array( |
| | 496 | 'component' => 'members', |
| | 497 | 'action' => 'last_activity', |
| | 498 | ) ); |
| | 499 | $a2 = $this->factory->activity->create( array( |
| | 500 | 'component' => 'groups', |
| | 501 | 'action' => 'created_group', |
| | 502 | ) ); |
| | 503 | $a3 = $this->factory->activity->create( array( |
| | 504 | 'component' => 'friends', |
| | 505 | 'action' => 'friendship_accepted', |
| | 506 | ) ); |
| | 507 | $a4 = $this->factory->activity->create( array( |
| | 508 | 'component' => 'members', |
| | 509 | 'action' => 'foo', |
| | 510 | ) ); |
| | 511 | |
| | 512 | $found = BP_Activity_Activity::get_recorded_components( true ); |
| | 513 | sort( $found ); |
| | 514 | |
| | 515 | $this->assertSame( array( 'friends', 'groups', 'members' ), BP_Activity_Activity::get_recorded_components() ); |
| | 516 | } |
| | 517 | |
| | 518 | /** |
| | 519 | * @group get_recorded_components |
| | 520 | */ |
| | 521 | public function test_get_recorded_components_skip_last_activity_true_la_in_multiple_components() { |
| | 522 | $a1 = $this->factory->activity->create( array( |
| | 523 | 'component' => 'members', |
| | 524 | 'action' => 'last_activity', |
| | 525 | ) ); |
| | 526 | $a2 = $this->factory->activity->create( array( |
| | 527 | 'component' => 'groups', |
| | 528 | 'action' => 'created_group', |
| | 529 | ) ); |
| | 530 | $a3 = $this->factory->activity->create( array( |
| | 531 | 'component' => 'friends', |
| | 532 | 'action' => 'friendship_accepted', |
| | 533 | ) ); |
| | 534 | $a4 = $this->factory->activity->create( array( |
| | 535 | 'component' => 'groups', |
| | 536 | 'action' => 'last_activity', |
| | 537 | ) ); |
| | 538 | |
| | 539 | $found = BP_Activity_Activity::get_recorded_components( true ); |
| | 540 | sort( $found ); |
| | 541 | |
| | 542 | $this->assertSame( array( 'friends', 'groups', ), BP_Activity_Activity::get_recorded_components() ); |
| | 543 | } |
| | 544 | /** |