You are here

public function BrowserKitDriver::setBasicAuth in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php \Behat\Mink\Driver\BrowserKitDriver::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 CoreDriver::setBasicAuth

1 method overrides BrowserKitDriver::setBasicAuth()
GoutteDriver::setBasicAuth in vendor/behat/mink-goutte-driver/src/GoutteDriver.php
Sets HTTP Basic authentication parameters.

File

vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php, line 192

Class

BrowserKitDriver
Symfony2 BrowserKit driver.

Namespace

Behat\Mink\Driver

Code

public function setBasicAuth($user, $password) {
  if (false === $user) {
    unset($this->serverParameters['PHP_AUTH_USER'], $this->serverParameters['PHP_AUTH_PW']);
    return;
  }
  $this->serverParameters['PHP_AUTH_USER'] = $user;
  $this->serverParameters['PHP_AUTH_PW'] = $password;
}