symfony phpUnit功能测试打印响应而不是检查测试用例

时间:2015-02-26 09:59:49

标签: phpunit symfony-1.4 functional-testing web-api-testing

我正在使用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();


在此线路工作之前回声死亡,但在此线路回声模块不工作之后 SomeWhere die用于此功能,我无法找到。请帮忙。

0 个答案:

没有答案