function QuickStartTestBase::formLogin

Same name in other branches
  1. 9 core/tests/Drupal/BuildTests/QuickStart/QuickStartTestBase.php \Drupal\BuildTests\QuickStart\QuickStartTestBase::formLogin()
  2. 10 core/tests/Drupal/BuildTests/QuickStart/QuickStartTestBase.php \Drupal\BuildTests\QuickStart\QuickStartTestBase::formLogin()
  3. 11.x core/tests/Drupal/BuildTests/QuickStart/QuickStartTestBase.php \Drupal\BuildTests\QuickStart\QuickStartTestBase::formLogin()

Helper that uses Drupal's user/login form to log in.

Parameters

string $username: Username.

string $password: Password.

string $working_dir: (optional) A working directory within which to login. Defaults to the workspace directory.

1 call to QuickStartTestBase::formLogin()
HtRouterTest::testHtRouter in core/tests/Drupal/BuildTests/Framework/Tests/HtRouterTest.php
@covers ::instantiateServer

File

core/tests/Drupal/BuildTests/QuickStart/QuickStartTestBase.php, line 56

Class

QuickStartTestBase
Helper methods for using the quickstart feature of Drupal.

Namespace

Drupal\BuildTests\QuickStart

Code

public function formLogin($username, $password, $working_dir = NULL) {
    $this->visit('/user/login', $working_dir);
    $assert = $this->getMink()
        ->assertSession();
    $assert->statusCodeEquals(200);
    $assert->fieldExists('edit-name')
        ->setValue($username);
    $assert->fieldExists('edit-pass')
        ->setValue($password);
    $session = $this->getMink()
        ->getSession();
    $session->getPage()
        ->findButton('Log in')
        ->submit();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.