public function UserProtectViewsBulkOperationsWebTest::testStatusProtection in User protect 7
Tests if users that are status protected can not be blocked in bulk.
File
- tests/
UserProtectViewsBulkOperationsWebTest.test, line 61 - Contains UserProtectViewsBulkOperationsWebTest.
Class
- UserProtectViewsBulkOperationsWebTest
- Tests if user bulk operations provided by Views Bulk Operations are protected.
Code
public function testStatusProtection() {
// Create an user with status protection.
$protected_account = $this
->createProtectedUser(array(
'up_status' => 1,
));
// Ensure this account is not blocked.
$this
->assertEqual(1, $protected_account->status, 'The protected user is not blocked.');
// Try to block the account.
$edit = array(
'views_bulk_operations[' . ($protected_account->uid - 1) . ']' => TRUE,
'operation' => 'action::user_block_user_action',
);
$this
->drupalPost('test-user-bulk-form', $edit, t('Execute'));
// Re-load the protected account and ensure it is still not blocked.
$protected_account = user_load($protected_account->uid, TRUE);
$this
->assertEqual(1, $protected_account->status, 'The protected user is not blocked.');
}