0

我正在使用 Symfony 1.4
使用 phpunit 功能测试

<?php

include(dirname(__FILE__).'/../../bootstrap/functional.php');

$browser = new sfTestFunctional(new sfBrowser());

$browser->
  get('/api/v2/membership/membershipDetails')->

  with('request')->begin()->
    isParameter('module', 'api')->
    isParameter('action', 'apiRequest')->
  end()->

  with('response')->begin()->
    isStatusCode(200)->
  end()
;

预计会给出类似的输出

ok 1 - request parameter module is api
ok 2 - request parameter action is apiRequest
ok 3 - status code is 200
1..3
# Looks like everything went fine.

但我的代码将 API 响应作为输出 -

    # get /api/v2/membership/membershipDetails
    {"responseStatusCode":"1","responseMessage":"Something went wrong. Please try again later.","AUTHCHECKSUM":null,"hamburgerDetails":null,"phoneDetails":null}
# Looks like everything went fine.

我试图更改一些 symfony 文件并发现-

lib/vendor/symfony/utils/sfBrowser.class.php<br>
line #44  -  $this->context->getController()->dispatch();


echo die 在此行工作之前,但在此行之后 echo die 不工作。
SomeWhere die 用于此功能,我无法找到。请在这方面提供帮助。

4

0 回答 0