【问题标题】:Symfony Panther - How tu keep SSL on localhost?Symfony Panther - 如何在本地主机上保持 SSL?
【发布时间】:2021-07-08 06:51:55
【问题描述】:

我正在使用 Panther 测试我的 Symfony 5 应用程序。

我需要测试我的 Stripe 支付系统。我可以填写表单字段,但是当我提交 Stripe 时出现错误:

(index):1 您可以通过 HTTP 测试您的 Stripe.js 集成。然而, 实时 Stripe.js 集成必须使用 HTTPS。

确实,Panther 似乎不是用 HTTPS 而是用 HTTP 启动客户端的。

我在本地安装了 Symfony SSL 证书(所以我可以访问 https://127.0.0.1:8000)

但是 Panther 只会运行 http://127.0.0.1:9080(9080 是 panther 在启动测试时占用的端口)

我该如何解决这个问题? 我在文档中没有看到任何选项(https://github.com/symfony/panther),也没有在这个主题上看到任何出路

这是我的代码:

$client = static::createPantherClient();
$client->request('GET', '/website/tarifs');

//fill the form and submit

【问题讨论】:

  • 请分享更多细节。您如何请求数据?

标签: php selenium symfony ssl localhost


【解决方案1】:

Panther 的内部网络服务器仅使用 http(如您所见 in the code)。如果你想使用 SSL,你必须使用你自己的网络服务器来处理加密层。这工作为documented:

    public function testMyApp(): void
    {
        $pantherClient = static::createPantherClient(['external_base_uri' => 'https://localhost']);
        // the PHP integrated web server will not be started
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-17
    • 1970-01-01
    • 1970-01-01
    • 2017-04-27
    • 2022-11-24
    • 2015-09-03
    • 2017-01-18
    相关资源
    最近更新 更多