comparison core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children a9cd425dd02b
comparison
equal deleted inserted replaced
-1:000000000000 0:c75dbcec494b
1 <?php
2
3 namespace Drupal\FunctionalJavascriptTests;
4
5 use Behat\Mink\Driver\Selenium2Driver;
6
7 /**
8 * Provides a driver for Selenium testing.
9 */
10 class DrupalSelenium2Driver extends Selenium2Driver {
11
12 /**
13 * {@inheritdoc}
14 */
15 public function setCookie($name, $value = NULL) {
16 if ($value === NULL) {
17 $this->getWebDriverSession()->deleteCookie($name);
18 return;
19 }
20
21 $cookieArray = [
22 'name' => $name,
23 'value' => urlencode($value),
24 'secure' => FALSE,
25 // Unlike \Behat\Mink\Driver\Selenium2Driver::setCookie we set a domain
26 // and an expire date, as otherwise cookies leak from one test site into
27 // another.
28 'domain' => parse_url($this->getWebDriverSession()->url(), PHP_URL_HOST),
29 'expires' => time() + 80000,
30 ];
31
32 $this->getWebDriverSession()->setCookie($cookieArray);
33 }
34
35 }