- Timestamp:
- 03/20/2019 05:40:17 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/PrivacyExportPersonalData.php
r44909 r44943 155 155 156 156 $this->_setRole( 'administrator' ); 157 // export_others_personal_data meta cap in Multisite installation is only granted to those with `manage_network` capability. 158 if ( is_multisite() ) { 159 grant_super_admin( get_current_user_id() ); 160 } 157 161 } 158 162 … … 163 167 remove_filter( 'wp_privacy_personal_data_exporters', array( $this, 'filter_register_custom_personal_data_exporter' ) ); 164 168 169 if ( is_multisite() ) { 170 revoke_super_admin( get_current_user_id() ); 171 } 165 172 parent::tearDown(); 166 173 } … … 261 268 $this->assertFalse( $this->_last_response_parsed['success'] ); 262 269 $this->assertFalse( current_user_can( 'export_others_personal_data' ) ); 270 $this->assertSame( 'Sorry, you are not allowed to perform this action.', $this->_last_response_parsed['data'] ); 271 } 272 273 /** 274 * Test requests do not succeed on multisite when the current user is not a network admin. 275 * 276 * @group multisite 277 * 278 * @ticket 43438 279 */ 280 public function test_error_when_current_user_missing_required_capability_multisite() { 281 if ( ! is_multisite() ) { 282 $this->markTestSkipped( 'This test only runs on multisite.' ); 283 } 284 285 revoke_super_admin( get_current_user_id() ); 286 287 $this->_make_ajax_call(); 288 289 $this->assertFalse( $this->_last_response_parsed['success'] ); 263 290 $this->assertSame( 'Sorry, you are not allowed to perform this action.', $this->_last_response_parsed['data'] ); 264 291 }
Note: See TracChangeset
for help on using the changeset viewer.