function QuickStartTestBase::formLogin

Same name in other branches
  1. 9 core/tests/Drupal/BuildTests/QuickStart/QuickStartTestBase.php \Drupal\BuildTests\QuickStart\QuickStartTestBase::formLogin()
  2. 8.9.x core/tests/Drupal/BuildTests/QuickStart/QuickStartTestBase.php \Drupal\BuildTests\QuickStart\QuickStartTestBase::formLogin()
  3. 10 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.

4 calls to QuickStartTestBase::formLogin()
GenerateThemeTest::test in core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php
Tests the generate-theme command.
GenerateThemeTest::test in core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php
Tests the generate-theme command.
HtRouterTest::testHtRouter in core/tests/Drupal/BuildTests/Framework/Tests/HtRouterTest.php
@covers ::instantiateServer
TemplateProjectTestBase::formLogin in core/modules/package_manager/tests/src/Build/TemplateProjectTestBase.php
1 method overrides QuickStartTestBase::formLogin()
TemplateProjectTestBase::formLogin in core/modules/package_manager/tests/src/Build/TemplateProjectTestBase.php

File

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

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.