Changeset 44943
- Timestamp:
- 03/20/2019 05:40:17 PM (6 years ago)
- Location:
- trunk/tests/phpunit/tests/ajax
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/PrivacyErasePersonalData.php
r44909 r44943 141 141 142 142 $this->_setRole( 'administrator' ); 143 // erase_others_personal_data meta cap in Multisite installation is only granted to those with `manage_network` capability. 144 if ( is_multisite() ) { 145 grant_super_admin( get_current_user_id() ); 146 } 143 147 } 144 148 … … 149 153 remove_filter( 'wp_privacy_personal_data_erasers', array( $this, 'register_custom_personal_data_eraser' ) ); 150 154 $this->new_callback_value = ''; 155 156 if ( is_multisite() ) { 157 revoke_super_admin( get_current_user_id() ); 158 } 151 159 152 160 parent::tearDown(); … … 295 303 $this->assertFalse( current_user_can( 'erase_others_personal_data' ) ); 296 304 $this->assertFalse( current_user_can( 'delete_users' ) ); 305 306 $this->_make_ajax_call(); 307 308 $this->assertFalse( $this->_last_response_parsed['success'] ); 309 $this->assertSame( 'Sorry, you are not allowed to perform this action.', $this->_last_response_parsed['data'] ); 310 } 311 312 /** 313 * Test requests do not succeed on multisite when the current user is not a network admin. 314 * 315 * @group multisite 316 * 317 * @ticket 43438 318 */ 319 public function test_error_when_current_user_missing_required_capabilities_multisite() { 320 if ( ! is_multisite() ) { 321 $this->markTestSkipped( 'This test only runs on multisite.' ); 322 } 323 324 revoke_super_admin( get_current_user_id() ); 297 325 298 326 $this->_make_ajax_call(); -
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.