Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
symfony 2.8 phpunit默认测试返回失败_Php_Symfony_Unit Testing_Phpunit_Default - Fatal编程技术网

symfony 2.8 phpunit默认测试返回失败

symfony 2.8 phpunit默认测试返回失败,php,symfony,unit-testing,phpunit,default,Php,Symfony,Unit Testing,Phpunit,Default,我在PHPUnit中有以下默认测试,它返回失败。我已经从浏览器访问了路径,它显示得很好 class DefaultControllerTest extends WebTestCase { public function testIndex() { $client = static::createClient(); $crawler = $client->request('GET', '/hello/Fabien'); $t

我在PHPUnit中有以下默认测试,它返回失败。我已经从浏览器访问了路径,它显示得很好

class DefaultControllerTest extends WebTestCase
{
    public function testIndex()
    {
        $client = static::createClient();

        $crawler = $client->request('GET', '/hello/Fabien');

        $this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
    }
}
config_test.yml

imports:
    - { resource: config_dev.yml }

framework:
    test: ~
    session:
        storage_id: session.storage.mock_file
    profiler:
        enabled: true # we want the profiler service to be defined
        collect: false

web_profiler:
    toolbar: false
    intercept_redirects: false

swiftmailer:
    disable_delivery: true

检查
日志/tests.log
后。错误来自翻译消息,在添加了显示成功消息后,很少有消息没有开始和结束引号

您是否检查了
var/logs/tst.log
以确定它得到了正确的路由,并且没有其他错误?另外,您可以试试
$this->assertContains('Hello Fabien',$client->getResponse()->getContent())以查看是否有效。如果是这样,您将不得不根据内容修改过滤器。执行单元测试时使用的命令是什么?我需要使用此命令执行单元测试
phpunit-c phpunit.xml.dist
,以使它们正常运行。检查
日志/tests.log
后,您会收到什么错误消息?@AlvinBunk。错误来自翻译消息,在添加了显示成功消息后,很少有消息没有开始和结束引号。非常感谢。