Php 使用Symfony的表单功能测试用例
我为contqact表单编写了简单的代码,其中包含字段name、email和message。我想为它编写测试用例,以检查用户输入字段值是否和预期值匹配。但是,当我使用命令“/symfony test:functional frontend contact”执行“contactTest.php”文件时,并没有获得用户输入值 代码:Php 使用Symfony的表单功能测试用例,php,forms,symfony-1.4,functional-testing,Php,Forms,Symfony 1.4,Functional Testing,我为contqact表单编写了简单的代码,其中包含字段name、email和message。我想为它编写测试用例,以检查用户输入字段值是否和预期值匹配。但是,当我使用命令“/symfony test:functional frontend contact”执行“contactTest.php”文件时,并没有获得用户输入值 代码: enter code here <?php include('/home/APP/test/bootstrap/functional.php'); $brow
enter code here
<?php
include('/home/APP/test/bootstrap/functional.php');
$browser = new sfTestFunctional(new sfBrowser());
$browser->
get('/Contact/thankyou')->
with('request')->begin()->
isParameter('module', 'Contact')->
isParameter('action', 'thankyou')->
end();
$browser->
get('/Contact/index')->
click('Submit', array(
'name' => 'Test',
'email' => 'not.an.email',
'message' => 'message'
))->
isRedirected()->
followRedirect()->
with('response')->checkElement('#content ul li','Testa');
get('/Contact/thankyou', array('name' => 'Test'));
?>
在此处输入代码
请帮助我编写测试用例,以检查表单中的用户输入值和期望值。并建议如何运行和测试?在我看来,您忘记提供表单对象了。 你能分享你的表单模板吗 你可能想要这样的东西:
get('/Contact/index')->
click('Submit', array(
contact => array(
'name' => 'Test',
'email' => 'not.an.email',
'message' => 'message'
)
))->
在我看来,您忘记提供表单对象了。 你能分享你的表单模板吗 你可能想要这样的东西:
get('/Contact/index')->
click('Submit', array(
contact => array(
'name' => 'Test',
'email' => 'not.an.email',
'message' => 'message'
)
))->
这与函数式编程有什么关系?这与函数式编程有什么关系?