public function MassPasswordTestBase::getUserWeightFromAccountsArray in Mass Password Change 8
Get weight from accounts array.
Parameters
\Drupal\user\UserInterface[] $accounts: User objects.
int $uid: Searched user Id.
Return value
int|bool return FALSE, if user account with selected uid not found, otherwise return account object weight.
7 calls to MassPasswordTestBase::getUserWeightFromAccountsArray()
- MassPasswordChange::testAdminUserMassPasswordChange in tests/
src/ Functional/ MassPasswordChange.php - Test Password change function for Admin (uid=1) user.
- MassPasswordChange::testCurrentUserMassPasswordChange in tests/
src/ Functional/ MassPasswordChange.php - Test Password change function for current user.
- MassPasswordChange::testOtherUsersMassPasswordChange in tests/
src/ Functional/ MassPasswordChange.php - Test Change password function for other users.
- MassPasswordReset::testAdminUserMassPasswordReset in tests/
src/ Functional/ MassPasswordReset.php - Test Password reset function for Admin (uid=1) user.
- MassPasswordReset::testBlockedUserMassPasswordReset in tests/
src/ Functional/ MassPasswordReset.php - Test Password reset function with blocked user.
File
- tests/
src/ Functional/ MassPasswordTestBase.php, line 94
Class
- MassPasswordTestBase
- Test base class for mass_password_change module.
Namespace
Drupal\Tests\mass_password_change\FunctionalCode
public function getUserWeightFromAccountsArray(array $accounts, $uid) {
$weight = 0;
foreach ($accounts as $account) {
if ($account
->id() == $uid) {
return $weight;
}
$weight++;
}
return FALSE;
}