You are here

public function BrowserKitDriver::setCookie 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::setCookie()

Sets cookie.

Parameters

string $name:

string $value:

Throws

UnsupportedDriverActionException When operation not supported by the driver

DriverException When the operation cannot be done

Overrides CoreDriver::setCookie

File

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

Class

BrowserKitDriver
Symfony2 BrowserKit driver.

Namespace

Behat\Mink\Driver

Code

public function setCookie($name, $value = null) {
  if (null === $value) {
    $this
      ->deleteCookie($name);
    return;
  }
  $jar = $this->client
    ->getCookieJar();
  $jar
    ->set(new Cookie($name, $value));
}