You are here

public function GoutteDriver::setBasicAuth in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink-goutte-driver/src/GoutteDriver.php \Behat\Mink\Driver\GoutteDriver::setBasicAuth()

Sets HTTP Basic authentication parameters.

Parameters

string|Boolean $user user name or false to disable authentication:

string $password password:

Throws

UnsupportedDriverActionException When operation not supported by the driver

DriverException When the operation cannot be done

Overrides BrowserKitDriver::setBasicAuth

File

vendor/behat/mink-goutte-driver/src/GoutteDriver.php, line 36

Class

GoutteDriver
Goutte driver.

Namespace

Behat\Mink\Driver

Code

public function setBasicAuth($user, $password) {
  if (false === $user) {
    $this
      ->getClient()
      ->resetAuth();
    return;
  }
  $this
    ->getClient()
    ->setAuth($user, $password);
}