You are here

public function QuickStartTestBase::formLogin in Automatic Updates 8

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.

2 calls to QuickStartTestBase::formLogin()
InPlaceUpdateTest::testContribUpdate in tests/src/Build/InPlaceUpdateTest.php
@covers ::update @dataProvider contribProjectsProvider
QuickStartTestBase::installCore in tests/src/Build/QuickStart/QuickStartTestBase.php
Prepare core for testing.

File

tests/src/Build/QuickStart/QuickStartTestBase.php, line 122

Class

QuickStartTestBase
Helper methods for using the quickstart feature of Drupal.

Namespace

Drupal\Tests\automatic_updates\Build\QuickStart

Code

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