private function createGuzzleDriver()
 {
     $clientOptions = array();
     $client = new \Behat\Mink\Driver\Goutte\Client();
     $client->setClient(new \Guzzle\Http\Client('', $clientOptions));
     $driver = new \Behat\Mink\Driver\GoutteDriver($client);
     return $driver;
 }
Beispiel #2
0
 public function _initialize()
 {
     $client = new \Behat\Mink\Driver\Goutte\Client();
     $driver = new \Behat\Mink\Driver\GoutteDriver($client);
     $curl_config = array_merge($this->curl_defaults, $this->config['curl']);
     array_walk($curl_config, function ($a, &$b) {
         $b = "curl.{$b}";
     });
     $client->setClient($this->guzzle = new Client('', $curl_config));
     $this->session = new \Behat\Mink\Session($driver);
     parent::_initialize();
 }
 /**
  * Returns a new driver instance according to the browser configuration.
  *
  * @param BrowserConfiguration $browser The browser configuration.
  *
  * @return DriverInterface
  */
 public function createDriver(BrowserConfiguration $browser)
 {
     if (!class_exists('Behat\\Mink\\Driver\\GoutteDriver')) {
         throw new \RuntimeException('Install MinkGoutteDriver in order to use goutte driver.');
     }
     $driver_options = $browser->getDriverOptions();
     if ($this->_isGoutte1()) {
         $guzzle_client = $this->_buildGuzzle3Client($driver_options['guzzle_parameters']);
     } else {
         $guzzle_client = $this->_buildGuzzle4Client($driver_options['guzzle_parameters']);
     }
     $goutte_client = new \Behat\Mink\Driver\Goutte\Client($driver_options['server_parameters']);
     $goutte_client->setClient($guzzle_client);
     return new \Behat\Mink\Driver\GoutteDriver($goutte_client);
 }
Beispiel #4
0
 public function _initialize()
 {
     $client = new \Behat\Mink\Driver\Goutte\Client();
     $driver = new \Behat\Mink\Driver\GoutteDriver($client);
     // build up a Guzzle friendly list of configuration options
     // passed in both from our defaults and the respective
     // yaml configuration file (if applicable)
     $curl_config['curl.options'] = $this->curl_defaults;
     foreach ($this->config['curl'] as $key => $val) {
         if (defined($key)) {
             $curl_config['curl.options'][constant($key)] = $val;
         }
     }
     // Guzzle client requires that we set the ssl.certificate_authority config
     // directive if we wish to disable SSL verification
     if ($curl_config['curl.options'][CURLOPT_SSL_VERIFYPEER] !== true) {
         $curl_config['ssl.certificate_authority'] = false;
     }
     $client->setClient($this->guzzle = new Client('', $curl_config));
     $this->session = new \Behat\Mink\Session($driver);
     parent::_initialize();
 }
 /**
  * Initializes context.
  * Every scenario gets its own context object.
  *
  * @param array $parameters context parameters (set them up through behat.yml)
  */
 public function __construct(array $parameters)
 {
     $clientOptions = array();
     $client = new \Behat\Mink\Driver\Goutte\Client();
     $client->setClient(new \Guzzle\Http\Client('', $clientOptions));
     $driver = new \Behat\Mink\Driver\GoutteDriver($client);
     // Initialize your context here
 }