本文整理汇总了PHP中sfTestBrowser::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP sfTestBrowser::initialize方法的具体用法?PHP sfTestBrowser::initialize怎么用?PHP sfTestBrowser::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfTestBrowser
的用法示例。
在下文中一共展示了sfTestBrowser::initialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_login_success
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: dirname
<?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/');
示例3: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
*
* 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"]');
示例4: test_login_does_not_exist
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/');
}
示例5: test_login_require_for_organizations
public function test_login_require_for_organizations()
{
$b = new sfTestBrowser();
$b->initialize();
$b->get('/organization/list')->checkResponseElement('body', '/Login/')->checkResponseElement('body', '/Please login/');
}