开发者

Functional Testcases for Form using Symfony

I write Simple code for contqact Form,which contain fields name, email and message. I want to write test cases for it to check user enter fields value are match with the expected value or not. But i m not getting user enter value while I execute 'contactTest.php' file using command "./symfony test:functional frontend contact" Code:

enter code here  
<?php
include('/home/APP/test/bootstrap/functional.php');
$browser = new sfTestFunctional(new sfBrowser());
$browser->
    get('/Contact/thankyou')->
        with('request')->begin()->
        i开发者_如何学PythonsParameter('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'));
?>

Please help me to write testcase for checking user enter value in the form and expected value. And also suggest how to run & test?


It looks to me that you forgot to provide your form object. Can you share your form template?

You probably want something like this :

get('/Contact/index')->
click('Submit', array(
    contact => array(
        'name'      => 'Test',
        'email'        => 'not.an.email',
        'message'   => 'message'
    )
))->
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜