function OpenIDFunctionalTest::testBlockedUserLogin

Test that a blocked user cannot log in.

File

drupal/core/modules/openid/lib/Drupal/openid/Tests/OpenIDFunctionalTest.php, line 255
Definition of Drupal\openid\Tests\OpenIDFunctionalTest.

Class

OpenIDFunctionalTest
Test discovery and login using OpenID

Namespace

Drupal\openid\Tests

Code

function testBlockedUserLogin() {

  // Use a User-supplied Identity that is the URL of an XRDS document.
  $identity = url('openid-test/yadis/xrds', array(
    'absolute' => TRUE,
  ));

  // Log in and add an OpenID Identity to the account.
  $this
    ->drupalLogin($this->web_user);
  $this
    ->addIdentity($identity);
  $this
    ->drupalLogout();

  // Log in as an admin user and block the account.
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer users',
  ));
  $this
    ->drupalLogin($admin_user);
  $this
    ->drupalGet('admin/people');
  $edit = array(
    'operation' => 'block',
    'accounts[' . $this->web_user->uid . ']' => TRUE,
  );
  $this
    ->drupalPost('admin/people', $edit, t('Update'));
  $this
    ->assertRaw('The update has been performed.', 'Account was blocked.');
  $this
    ->drupalLogout();
  $this
    ->submitLoginForm($identity);
  $this
    ->assertRaw(t('The username %name has not been activated or is blocked.', array(
    '%name' => $this->web_user->name,
  )), 'User login was blocked.');
}