public function test_login_success()
 {
     $b = new sfTestBrowser();
     $b->initialize();
     $b->get('/')->click('Sign In', array('login' => 'isern', 'password' => 'testpassword'))->isRedirected()->followRedirect()->checkResponseElement('body', '/Researchers/');
     $b->get('/organization/list')->checkResponseElement('body', '/Organizations/')->checkResponseElement('body', '/Name/');
     $b->get('/collaboration/list')->checkResponseElement('body', '/Collaborations/')->checkResponseElement('body', '/Name/');
 }
Пример #2
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
// create a new test browser
$browser = new sfTestBrowser();
$browser->initialize();
$browser->get('/messages/index')->isStatusCode(200)->isRequestParameter('module', 'messages')->isRequestParameter('action', 'index')->checkResponseElement('body', '!/This is a temporary page/');
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
$app = 'frontend';
if (!(include dirname(__FILE__) . '/../bootstrap/functional.php')) {
    return;
}
$b = new sfTestBrowser();
$b->initialize();
// default main page
$b->get('/')->isStatusCode(200)->isRequestParameter('module', 'default')->isRequestParameter('action', 'index')->checkResponseElement('body', '/congratulations/i')->checkResponseElement('link[href="/sf/sf_default/css/screen.css"]');
// default 404
$b->get('/nonexistant')->isStatusCode(404)->isForwardedTo('default', 'error404')->checkResponseElement('body', '!/congratulations/i')->checkResponseElement('link[href="/sf/sf_default/css/screen.css"]');
// unexistant action
$b->get('/default/nonexistantaction')->isStatusCode(404)->isForwardedTo('default', 'error404')->checkResponseElement('link[href="/sf/sf_default/css/screen.css"]');
// available
sfConfig::set('sf_available', false);
$b->get('/')->isStatusCode(200)->isForwardedTo('default', 'unavailable')->checkResponseElement('body', '/unavailable/i')->checkResponseElement('body', '!/congratulations/i')->checkResponseElement('link[href="/sf/sf_default/css/screen.css"]');
sfConfig::set('sf_available', true);
// module.yml: enabled
$b->get('/configModuleDisabled')->isStatusCode(200)->isForwardedTo('default', 'disabled')->checkResponseElement('body', '/module is unavailable/i')->checkResponseElement('body', '!/congratulations/i')->checkResponseElement('link[href="/sf/sf_default/css/screen.css"]');
// view.yml: has_layout
$b->get('/configViewHasLayout/withoutLayout')->isStatusCode(200)->checkResponseElement('body', '/no layout/i')->checkResponseElement('head title', false);
// security.yml: is_secure
$b->get('/configSecurityIsSecure')->isStatusCode(200)->isForwardedTo('default', 'login')->checkResponseElement('body', '/Login Required/i')->checkResponseElement('body', 1)->checkResponseElement('link[href="/sf/sf_default/css/screen.css"]');
 public function test_login_does_not_exist()
 {
     $b = new sfTestBrowser();
     $b->initialize();
     $b->get('/')->click('Sign In', array('login' => 'isern', 'password' => 'isern2008xxx'))->checkResponseElement('body', '/This account does not exist/');
 }
 public function test_login_require_for_organizations()
 {
     $b = new sfTestBrowser();
     $b->initialize();
     $b->get('/organization/list')->checkResponseElement('body', '/Login/')->checkResponseElement('body', '/Please login/');
 }