为什么Codeception的PhpBrowser不遵循"重新加载"标题?

Jor*_*dge 5 php codeigniter ion-auth codeception

我在Ion Auth身份验证库中的一个真正的CodeIgniter项目中发生了这种情况,但为了清楚起见,我将其简化为最简单的形式.

剧本:

我有这一行脚本位于http://localhost/~captbaritone/redirect/index.php:

<?php header("Refresh:0;url=https://google.com");¬
Run Code Online (Sandbox Code Playgroud)

在我的浏览器中,它会重定向到Google.com.

考试:

为了测试它,我写了这个验收测试:

<?php
$I = new WebGuy($scenario);
$I->wantTo('Redirect to Google.com');
$I->amOnPage('/index.php');
$I->seeCurrentUrlEquals('https://www.google.com/');
Run Code Online (Sandbox Code Playgroud)

acceptance.suite.yml看起来像这样:

class_name: WebGuy
modules:
    enabled:
        - PhpBrowser
        - WebHelper
    config:
        PhpBrowser:
            url: 'http://localhost/~captbaritone/redirect/'
Run Code Online (Sandbox Code Playgroud)

结果:

Codeception PHP Testing Framework v1.7.1
Powered by PHPUnit 3.7.27 by Sebastian Bergmann.

Acceptance Tests (1) -----------------------------------------
Trying to redirect to google.com (RedirectCept.php)       Fail
---------------------------------------------------------------


Time: 460 ms, Memory: 9.75Mb

There was 1 failure:

---------
1) Failed to redirect to google.com in RedirectCept.php
Sorry, I couldn't see current url equals "https://www.google.com/":
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'https://www.google.com/'
+'/~captbaritone/redirect/index.php'

Scenario Steps:
2. I see current url equals "https://www.google.com/"
1. I am on page "/index.php"

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
Run Code Online (Sandbox Code Playgroud)

我的问题:

显然,PhpBrowser不遵守重定向.将重定向更改为位置标头允许测试通过,但我不希望(不能)更改我的应用程序以适应测试套件.

这是Codeception中的错误吗?在PhpBrowser?(我不是很清楚一个人从哪里开始而另一个人开始,或者PhpBrowser是否是一个单独的项目.)或者这可能是我无法从无头浏览器中获得的功能?

我应该透露这是我第一次使用测试套件.

sea*_*tes 1

这在 Codeception 2.0 中得到了修复:

https://github.com/Codeception/Codeception/issues/625#issuecomment-33281671

我建议您升级并重试。