Changeset 11052 for trunk/tests/phpunit/testcases/core/caps.php
- Timestamp:
- 09/01/2016 12:50:06 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/testcases/core/caps.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/caps.php
r10377 r11052 47 47 } 48 48 49 /**50 * @group bp_xprofile_change_field_visibility51 */52 public function test_bp_current_user_can_should_pass_null_in_args_parameter_if_empty() {53 $u = $this->factory->user->create();54 $this->set_current_user( $u );55 56 /**57 * Fake bp_get_the_profile_field_id() to pretend we're in the field loop and58 * to avoid notices when checking 'bp_xprofile_change_field_visibility' cap59 */60 $GLOBALS['field'] = new stdClass;61 $GLOBALS['field']->id = 1;62 63 // Capture the cap's $args64 add_filter( 'bp_xprofile_map_meta_caps', array( $this, 'check_cap_args' ), 10, 4 );65 66 // Use a cap check that depends on a null value for a cap's args67 bp_current_user_can( 'bp_xprofile_change_field_visibility' );68 69 // Assert!70 $this->assertEquals( null, $this->test_args[0] );71 72 // Reset73 remove_filter( 'bp_xprofile_map_meta_caps', array( $this, 'check_cap_args' ), 10, 4 );74 unset( $GLOBALS['field'], $this->test_args );75 }76 77 49 public function grant_cap_foo( $allcaps, $caps ) { 78 50 if ( bp_is_root_blog() ) {
Note: See TracChangeset
for help on using the changeset viewer.