How do you: Symfony functional test on a secure app?
Posted
by Dan Tudor
on Stack Overflow
See other posts from Stack Overflow
or by Dan Tudor
Published on 2010-04-09T10:28:20Z
Indexed on
2010/04/09
10:33 UTC
Read the original article
Hit count: 441
symfony
|functional-tests
Im trying to perform some function tests in symfony 1.4. My application is secure so the tests return 401 response codes not 200 as expected. I've tried creating a context and authentication the user prior to performing the test but to no avail. Any suggestions?
Do I need to pass sfContext to the sfTestFunctional?
Thanks
include(dirname(FILE).'/../../bootstrap/functional.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('backend', 'test', true); $context = sfContext::createInstance($configuration);
new sfDatabaseManager($configuration);
$loader = new sfPropelData(); $loader->loadData(sfConfig::get('sf_test_dir').'/fixtures'); // load test data
$user = sfGuardUserPeer::retrieveByUsername('test'); $context->getUser()->signin($user);
$browser = new sfTestFunctional(new sfBrowser()); $browser-> get('/')->
with('request')->begin()-> isParameter('module', 'video')-> isParameter('action', 'index')-> end()->
with('response')->begin()-> isStatusCode(200)-> //checkElement('body', '!/This is a temporary page/')-> end() ;
© Stack Overflow or respective owner