- Timestamp:
- 03/13/2014 06:34:06 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/testcases/activity/class.BP_Activity_Activity.php
r8012 r8125 440 440 $this->assertSame( date( 'Y-m-d H:i:s', $now - 100 ), BP_Activity_Activity::get_last_updated() ); 441 441 } 442 443 /** 444 * @group activity_action 445 */ 446 public function test_instantiated_action_with_dynamic_callback() { 447 bp_activity_set_action( 448 'foo', 449 'bar', 450 'Foo Bar', 451 array( $this, 'action_cb' ) 452 ); 453 454 // Create the activity item with a manual activity string 455 $a = $this->factory->activity->create( array( 456 'component' => 'foo', 457 'type' => 'bar', 458 'action' => 'baz', 459 ) ); 460 461 $a_obj = new BP_Activity_Activity( $a ); 462 463 $this->assertSame( 'Woo Hoo!', $a_obj->action ); 464 } 465 466 /** 467 * @group activity_action 468 */ 469 public function test_instantiated_action_without_dynamic_callback_but_with_stored_action() { 470 // No callback is registered - this mimics a legacy plugin 471 472 // Create the activity item with a manual activity string 473 $a = $this->factory->activity->create( array( 474 'component' => 'foo', 475 'type' => 'bar1', 476 'action' => 'baz', 477 ) ); 478 479 $a_obj = new BP_Activity_Activity( $a ); 480 481 $this->assertSame( 'baz', $a_obj->action ); 482 } 483 484 /** 485 * @group activity_action 486 */ 487 public function test_instantiated_action_without_dynamic_callback_but_with_no_stored_action() { 488 // No callback is registered - this mimics a legacy plugin 489 490 // Create the activity item with a manual activity string 491 $a = $this->factory->activity->create( array( 492 'component' => 'foo', 493 'type' => 'bar2', 494 ) ); 495 496 $a_obj = new BP_Activity_Activity( $a ); 497 498 $this->assertSame( '', $a_obj->action ); 499 } 500 501 public function action_cb( $activity ) { 502 return 'Woo Hoo!'; 503 } 442 504 }
Note: See TracChangeset
for help on using the changeset viewer.