我正在尝试使用WebGuy
登录我的应用。我创建了一个Cept
文件MergeCompaniesCept.php
,内容为:
$I = new WebGuy($scenario);
$I->wantTo('login into admin, merge companies, & verify data');
$I->amOnPage('/login.php');
$I->fillField("username","name");
$I->fillField("password","xxxxxxxxxxxxxxxxx");
$I->click("LOGIN");
但是我收到以下错误:
[Codeception\Exception\ModuleConfig]
Codeception\Util\Mink module is not configured!
Provided URL can't be accessed by this driver.
[curl] 77: [url] https://localhost/
[info]
array(
'url' => 'https://localhost/',
'content_type' => NULL,
'http_code' => 0,
'header_size' => 0,
'request_size' => 0,
'filetime' => -1,
'ssl_verify_result' => 0,
'redirect_count' => 0,
'total_time' => 0.002284,
'namelookup_time' => 0.00214,
'connect_time' => 0.002295,
'pretransfer_time' => 0,
'size_upload' => 0,
'size_download' => 0,
'speed_download' => 0,
'speed_upload' => 0,
'download_content_length' => -1,
'upload_content_length' => -1,
'starttransfer_time' => 0,
'redirect_time' => 0,
'certinfo' =>
),
array (
'primary_ip' => '127.0.0.1',
'primary_port' => 443,
'local_ip' => '127.0.0.1',
'local_port' => 41951,
'redirect_url' => '',
)
[debug]
run [-c|--config[="..."]] [--report] [--html] [--xml] [--tap] [--json] [--colors] [--silent] [--steps] [--debug] [-cc|--coverage] [--no-exit] [suite] [test]
我认为这个问题与自签名证书和没有-k的curl的使用有关,所以我对WebHelper进行了以下更改
<?php
namespace Codeception\Module;
class WebHelper extends \Codeception\Module\PhpBrowser {
public function _initialize() {
$client = new \Behat\Mink\Driver\Goutte\Client();
$driver = new \Behat\Mink\Driver\GoutteDriver($client);
$client->setClient(new \Guzzle\Http\Client('', array(
'curl.CURLOPT_SSL_VERIFYPEER' => false,
'curl.CURLOPT_CERTINFO' => false
)));
$this->session = new \Behat\Mink\Session($driver);
parent::_initialize();
}
}
然而,同样的错误仍然存在。
非常感谢任何帮助!
更新
以下更改最终解决了问题:
<?php
namespace Codeception\Module;
class WebHelper extends \Codeception\Module\PhpBrowser {
public function _initialize() {
$client = new \Behat\Mink\Driver\Goutte\Client();
$driver = new \Behat\Mink\Driver\GoutteDriver($client);
$client->setClient(new \Guzzle\Http\Client('', array(
//'curl.CURLOPT_SSL_VERIFYPEER' => false,
//'curl.CURLOPT_CERTINFO' => false
'ssl.certificate_authority' => false
)));
$this->session = new \Behat\Mink\Session($driver);
//parent::_initialize();
}
}
答案 0 :(得分:1)
尝试以下方法:
capabilities:
acceptSslCerts: true
acceptInsecureCerts: true
at acceptance.suite.yml
答案 1 :(得分:-1)
使用ssl.certificate_authority
选项:
$client = new Client($baseUrl, [
'ssl.certificate_authority' => false,
]);