LoginSignup
1
2

More than 5 years have passed since last update.

behatでhttps://localhostをテストする

Posted at

参考:http://stackoverflow.com/questions/34977817/behat-curl-ssl-certificate-error-on-localhost

問題

HTTPSなサイトをローカルでテストしようとすると、cURLエラーを喰らう。

実行結果

$ ./bin/behat
Feature: Can show Installer

  Scenario: redirect to wp-admin/install.php # features/00_installer.feature:3
    Given I am on the homepage               # Behat\MinkExtension\Context\MinkContext::iAmOnHomepage()
      cURL error 60: SSL certificate problem: Invalid certificate chain (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) (GuzzleHttp\Exce
ption\RequestException)
    Then print current URL                   # Behat\MinkExtension\Context\MinkContext::printCurrentUrl()

--- Failed scenarios:

    features/00_installer.feature:3


1 scenario (1 failed)
2 steps (1 failed, 1 skipped)
0m0.12s (13.21Mb)

対応

behat.ymlでverifyをfalseにすればつながる。

behat.yml
default:
  extensions:
    Behat\MinkExtension:
      base_url: https://localhost:8443/
      goutte:
        guzzle_parameters:
          verify: false
  suites:
    default:
      contexts:
        - 'Behat\MinkExtension\Context\MinkContext'
paths:
  features: features
  bootstrap: %behat.paths.features%/bootstrap

実行結果

$ ./bin/behat

Feature: Can show Installer

  Scenario: redirect to wp-admin/install.php # features/00_installer.feature:3
    Given I am on the homepage               # Behat\MinkExtension\Context\MinkContext::iAmOnHomepage()
    Then print current URL                   # Behat\MinkExtension\Context\MinkContext::printCurrentUrl()
      │ https://localhost:8443/wp-admin/install.php

1 scenario (1 passed)
2 steps (2 passed)
0m1.30s (13.48Mb)
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2