Changeset 9173 for trunk/tests/phpunit/testcases/friends/functions.php
- Timestamp:
- 11/25/2014 02:51:55 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/friends/functions.php
r9139 r9173 6 6 */ 7 7 class BP_Tests_Friends_Functions extends BP_UnitTestCase { 8 9 protected $filter_fired; 10 11 public function setUp() { 12 parent::setUp(); 13 $this->filter_fired = ''; 14 } 15 16 public function tearDown() { 17 parent::tearDown(); 18 } 8 19 9 20 /** … … 228 239 $this->assertSame( $expected, $found ); 229 240 } 241 242 /** 243 * @group friends_add_friend 244 */ 245 public function test_friends_add_friend_friends_friendship_requested() { 246 $u1 = $this->factory->user->create(); 247 $u2 = $this->factory->user->create(); 248 249 add_filter( 'friends_friendship_requested', array( $this, 'friends_friendship_filter_callback' ) ); 250 $n = friends_add_friend( $u1, $u2, false ); 251 remove_filter( 'friends_friendship_requested', array( $this, 'friends_friendship_filter_callback' ) ); 252 253 $this->assertSame( 'friends_friendship_requested', $this->filter_fired ); 254 } 255 256 /** 257 * @group friends_add_friend 258 */ 259 public function test_friends_add_friend_friends_friendship_accepted() { 260 $u1 = $this->factory->user->create(); 261 $u2 = $this->factory->user->create(); 262 263 add_filter( 'friends_friendship_accepted', array( $this, 'friends_friendship_filter_callback' ) ); 264 $n = friends_add_friend( $u1, $u2, true ); 265 remove_filter( 'friends_friendship_accepted', array( $this, 'friends_friendship_filter_callback' ) ); 266 267 $this->assertSame( 'friends_friendship_accepted', $this->filter_fired ); 268 } 269 270 public function friends_friendship_filter_callback( $value ) { 271 $this->filter_fired = current_filter(); 272 return $value; 273 } 230 274 }
Note: See TracChangeset
for help on using the changeset viewer.