PHPunit:表单祖先未找到

时间:2015-06-04 09:19:41

标签: php laravel phpunit

我有一个简单的表格:

import logging

logpath = "/tmp/log.log"
logger = logging.getLogger('log')
logger.setLevel(logging.INFO)
ch = logging.FileHandler(logpath)
ch.setFormatter(logging.Formatter('%(message)s'))
logger.addHandler(ch)


def application(env, start_response):
   logger.info("%s %s".format("hello","world!"))
   start_response('200 OK', [('Content-Type', 'text/html')])
   return ["Hello!"]

我想使用Laravel的Laracasts \ Integrated软件包测试此表单。 我有以下测试方法:

      <!--NEW FORM-->
<form method="POST" action="http://192.168.114.139/family/search_results" accept-charset="UTF-8" id="admin-form"><input
        name="_token" type="hidden" value="7v2IhbTkiMRVyojJ8Vuv0dDdRqySzO18Z6gPWKP2">

    <input class="gui-input" id="search_term" placeholder="" name="search_term" type="text">

    <div class="panel-footer text-right">
        <input class="button btn-primary" name="submit" id="search" type="submit" value="Search">
        <button class="button btn-danger" type="reset">Reset</button>
    </div>
</form>

当我运行测试时,我收到以下错误:

有1个错误:

/** @test */
public function it_can_search()
{
    $this->login()
        ->visit('/identification/search_family/')
        ->see('Search Families')
        ->submitForm('Search',['search_term' => 'tests'])
        ->seePageIs('/identification/search_family/');
}

我知道错误意味着Dom-crawler无法找到与输入关联的表单,但我不明白为什么......谢谢!

0 个答案:

没有答案