Symfony2功能测试InvalidArgumentException:当前节点列表为空
发布时间:2020-12-13 16:38:37 所属栏目:PHP教程 来源:网络整理
导读:我得到“InvalidArgumentException:当前节点列表为空”.通过 PHPUnit运行功能测试.这是我写的测试: public function testAdd(){ $client = static::createClientWithAuthentication('main'); $crawler = $client-request('GET','en/manage'); $send_button
我得到“InvalidArgumentException:当前节点列表为空”.通过
PHPUnit运行功能测试.这是我写的测试:
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())来调试问题;
另外,我想你应该写这个: $crawler = $client->submit($form); 否则,您将在表单提交之前测试第一个URL的响应. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |