Symfony2 functional testing InvalidArgumentException: The current node list is empty

前端 未结 7 745
伪装坚强ぢ
伪装坚强ぢ 2020-12-18 23:41

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

public function testAdd()         


        
7条回答
  •  生来不讨喜
    2020-12-19 00:22

    I had the same problem with Silex application. I was looking for

    $buttonCrawler = $crawler->selectButton('input[type="submit"]');
    

    Instead, the correct way to do it is give the value of the button

    $buttonCrawler = $crawler->selectButton('value_of_the_button');
    


    For example, in your page:

    ...


    And in your tests:

    $buttonCrawler = $crawler->selectButton('Click Me');
    $form = $buttonCrawler->form();
    ...
    

提交回复
热议问题