Symfony2功能测试InvalidArgumentException:当前节点列表为空 [英] Symfony2 functional testing InvalidArgumentException: The current node list is empty

查看:102
本文介绍了Symfony2功能测试InvalidArgumentException:当前节点列表为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到"InvalidArgumentException:当前节点列表为空".通过PHPUnit运行功能测试.这是我写的测试:

I get "InvalidArgumentException: The current node list is empty." running functional tests through PHPUnit. Here is test i wrote:

public function testAdd()
{
    $client = static::createClientWithAuthentication('main');

    $crawler = $client->request('GET', 'en/manage');

    $send_button = $crawler->selectButton('submit');

    $form = $send_button->form(array(
        'PrCompany[email]' => 'test@example.ua',
        'PrCompany[first_name]' => 'Anton',
        'PrCompany[last_name]' => 'Tverdiuh',
        'PrCompany[timezone]' => 'Europe/Amsterdam'
    ));

    $form['PrCompany[companies][1]']->tick();

    $client->submit($form);


    $this->assertTrue($crawler->filter('html:contains("User is invited")')->count() > 0);

}

推荐答案

您可以使用var_dump($client->getResponse()->getContent());

此外,我认为您应该这样写:

Additionally, I think you should write this:

$crawler = $client->submit($form);

否则,您将在提交表单之前测试第一个URL的响应.

Otherwise you'll be testing the response of the first url, before form submission.

这篇关于Symfony2功能测试InvalidArgumentException:当前节点列表为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆