How to configure curl parameters in Mink?
Yes, it's known problem and the only solution for now is something like this in your behat.yml:
default: paths: features: . bootstrap: %behat.paths.features%/bootstrap extensions: Behat\MinkExtension\Extension: base_url: http://yourhost/ goutte: guzzle_parameters: ssl.certificate_authority: system curl.options: 64: false # CURLOPT_SSL_VERIFYPEER 172: false # CURLOPT_CERTINFO
For now what you need to set in behat.yml is this:
default: extensions: Behat\MinkExtension\Extension: goutte: guzzle_parameters: curl.options: CURLOPT_SSL_VERIFYPEER: 0 CURLOPT_CERTINFO: 0 CURLOPT_SSL_VERIFYHOST: 0 ssl.certificate_authority: system
After this pull request https://github.com/guzzle/guzzle/pull/498 is merged you will be able to just do:
default: extensions: Behat\MinkExtension\Extension: goutte: guzzle_parameters: ssl.certificate_authority: false
Please note that I am using string constants instead of integer ones as they are way more readable. You don't have to use integers here as the proper constant/integer conversion is done inside Guzzle.
Also, I've added CURLOPT_SSL_VERIFYHOST which will solve your problem.
Mink uses Goutte which internally initialises Guzzle (see: https://github.com/fabpot/Goutte/blob/master/Goutte/Client.php#L45).
Here's how you could initialise Guzzle to solve your issue: https://github.com/fabpot/Goutte/issues/63#issuecomment-6371727
While there are multiple ways of solving this issue the simplest solutions I can see now are
- either implementing your own class and overwriting behat.mink.goutte.class (see https://github.com/Behat/MinkExtension/blob/master/src/Behat/MinkExtension/services/sessions/goutte.xml#L8)
- or calling setClient() somewhere to overwrite the client (like in an issue I wrote above).
Other (maybe cleaner) way would be altering service definition with a compiler pass and make it to call setClient().