我得到“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())来调试问题;
原文链接:https://www.f2er.com/php/131864.html另外,我想你应该写这个:
$crawler = $client->submit($form);
否则,您将在表单提交之前测试第一个URL的响应.