本文整理汇总了PHP中sfTestBrowser::setTester方法的典型用法代码示例。如果您正苦于以下问题:PHP sfTestBrowser::setTester方法的具体用法?PHP sfTestBrowser::setTester怎么用?PHP sfTestBrowser::setTester使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfTestBrowser
的用法示例。
在下文中一共展示了sfTestBrowser::setTester方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?php
include dirname(__FILE__) . '/../../bootstrap/functional.php';
try {
// first drop database
$this->runTask('doctrine:drop-db', '--no-confirmation');
$database_file = sfConfig::get('sf_config_dir') . DIRECTORY_SEPARATOR . 'databases.yml';
$database_file_content = file_get_contents($database_file);
$config_file = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'config.php';
$config_file_content = file_get_contents($config_file);
$browser = new sfTestBrowser();
$browser->setTester('doctrine', 'sfTesterDoctrine');
$browser->info('Test the first page')->get('/')->with('request')->begin()->isParameter('module', 'static')->isParameter('action', 'step1')->end()->info('Trying to jump steps redirect to my step')->get('/step3')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'static')->isParameter('action', 'step1')->end()->setField('language', 'en')->click('next')->with('response')->begin()->isRedirected()->end()->post('/step2')->followRedirect()->with('request')->begin()->isParameter('module', 'static')->isParameter('action', 'step3')->end()->click('next')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'static')->isParameter('action', 'step4')->end()->setField('db[database]', 'siwapp_test')->setField('db[username]', 'siwapp')->setField('db[password]', 'wappis')->setField('db[host]', 'bbdd')->click('next')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'static')->isParameter('action', 'step5')->end()->setField('config[admin_email]', 'e@test.org')->setField('config[admin_username]', 'test')->setField('config[admin_password', 'test')->setField('config[admin_password_bis]', 'test')->setField('config[preload]', true)->click('next')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'static')->isParameter('action', 'step6')->end()->with('response')->begin()->info('Testing there were no sql errors')->checkElement('ul.error_list li:first-child', false)->end();
$browser->info('Test the data inserted')->with('doctrine')->begin()->check('sfGuardUser', array('username' => 'test', 'is_super_admin' => 1))->check('Profile', array('email' => 'e@test.org', 'language' => 'en'))->end();
// this is to revert always the files modified, because
// with errors there is no 'Finish' button
$browser->info('Test the redirection to the application')->click('Finish')->with('response')->begin()->isRedirected()->end();
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;
}
$browser->info('Reverting modified files');
@file_put_contents($database_file, $database_file_content);
@file_put_contents($config_file, $config_file_content);
$browser->info('Reverting cache and database');
$this->runTask('cc');
$this->runTask('siwapp:test-data-load', '--env=test');
示例2: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) 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';
$fixtures = 'fixtures/fixtures.yml';
if (!(include dirname(__FILE__) . '/../bootstrap/functional.php')) {
return;
}
$b = new sfTestBrowser(new sfBrowser());
$b->setTester('propel', 'sfTesterPropel');
// en
$b->get('/i18n/default')->with('request')->begin()->isParameter('module', 'i18n')->isParameter('action', 'default')->end()->with('response')->begin()->isStatusCode(200)->checkElement('#movies .toString:first', '')->checkElement('#movies .default:first', '')->checkElement('#movies .it:first', 'La Vita è bella')->checkElement('#movies .fr:first', 'La Vie est belle')->end();
// it
$b->get('/i18n/queryPropel')->with('request')->begin()->isParameter('module', 'i18n')->isParameter('action', 'queryPropel')->end()->with('response')->begin()->isStatusCode(200)->checkElement('#movies .propel_it:first', 'La Vita è bella')->end();
// fr
$b->get('/i18n/index')->with('request')->begin()->isParameter('module', 'i18n')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('#movies .toString:first', 'La Vie est belle')->checkElement('#movies .default:first', 'La Vie est belle')->checkElement('#movies .it:first', 'La Vita è bella')->checkElement('#movies .fr:first', 'La Vie est belle')->end();
// still fr
$b->get('/i18n/default')->with('request')->begin()->isParameter('module', 'i18n')->isParameter('action', 'default')->end()->with('response')->begin()->isStatusCode(200)->checkElement('#movies .toString:first', 'La Vie est belle')->checkElement('#movies .default:first', 'La Vie est belle')->checkElement('#movies .it:first', 'La Vita è bella')->checkElement('#movies .fr:first', 'La Vie est belle')->end();
// SfPropelBehaviorI18n (part of sfPropelORMPlugin)
$b->get('/i18n/movie')->with('request')->begin()->isParameter('module', 'i18n')->isParameter('action', 'movie')->end()->with('response')->begin()->isStatusCode(200)->checkElement('#movie_fr_id', false)->checkElement('#movie_fr_culture', false)->end()->click('submit', array('movie' => array('director' => 'Robert Aldrich', 'en' => array('title' => 'The Dirty Dozen'), 'fr' => array('title' => 'Les Douze Salopards'))))->with('response')->begin()->isRedirected()->followRedirect()->end()->with('response')->begin()->checkElement('input[value="Robert Aldrich"]')->checkElement('input[value="The Dirty Dozen"]')->checkElement('input[value="Les Douze Salopards"]')->checkElement('#movie_fr_id', true)->checkElement('#movie_fr_culture', true)->end()->with('propel')->begin()->check('Movie', array(), 2)->check('Movie', array('director' => 'Robert Aldrich', 'id' => 2))->check('MovieI18N', array(), 4)->check('MovieI18N', array('id' => 2), 2)->check('MovieI18N', array('culture' => 'fr', 'id' => 2, 'title' => 'Les Douze Salopards'))->check('MovieI18N', array('culture' => 'en', 'id' => 2, 'title' => 'The Dirty Dozen'))->end()->click('submit', array('movie' => array('director' => 'Robert Aldrich (1)', 'en' => array('title' => 'The Dirty Dozen (1)'), 'fr' => array('title' => 'Les Douze Salopards (1)'))))->with('response')->begin()->isRedirected()->followRedirect()->end()->with('response')->begin()->checkElement('input[value="Robert Aldrich (1)"]')->checkElement('input[value="The Dirty Dozen (1)"]')->checkElement('input[value="Les Douze Salopards (1)"]')->end()->with('propel')->begin()->check('Movie', array(), 2)->check('Movie', array('director' => 'Robert Aldrich (1)', 'id' => 2))->check('MovieI18N', array(), 4)->check('MovieI18N', array('id' => 2), 2)->check('MovieI18N', array('culture' => 'fr', 'id' => 2, 'title' => 'Les Douze Salopards (1)'))->check('MovieI18N', array('culture' => 'en', 'id' => 2, 'title' => 'The Dirty Dozen (1)'))->end()->click('submit')->with('form')->begin()->hasErrors(false)->end()->get('/i18n/movie')->click('submit', array('movie' => array('director' => 'Robert Aldrich', 'en' => array('title' => 'The Dirty Dozen (1)'), 'fr' => array('title' => 'Les Douze Salopards (1)'))))->with('form')->begin()->hasErrors(2)->end()->click('submit', array('movie' => array('director' => 'Robert Aldrich', 'en' => array('title' => 'The Dirty Dozen'), 'fr' => array('title' => 'Les Douze Salopards'))))->with('form')->begin()->hasErrors(false)->end()->with('response')->begin()->isRedirected()->followRedirect()->end()->with('response')->begin()->checkElement('input[value="Robert Aldrich"]')->checkElement('input[value="The Dirty Dozen"]')->checkElement('input[value="Les Douze Salopards"]')->end();
// Symfony integration with BehaviorI18n (part of Propel)
$b->get('/i18n/moviePropel')->with('request')->begin()->isParameter('module', 'i18n')->isParameter('action', 'moviePropel')->end()->with('response')->begin()->isStatusCode(200)->checkElement('#movie_propel_fr_id', false)->checkElement('#movie_propel_fr_locale', false)->end()->click('submit', array('movie_propel' => array('director' => 'Robert Aldrich', 'en' => array('title' => 'The Dirty Dozen'), 'fr' => array('title' => 'Les Douze Salopards'))))->with('response')->begin()->isRedirected()->followRedirect()->end()->with('response')->begin()->checkElement('input[value="Robert Aldrich"]')->checkElement('input[value="The Dirty Dozen"]')->checkElement('input[value="Les Douze Salopards"]')->checkElement('#movie_propel_fr_id', true)->checkElement('#movie_propel_fr_locale', true)->end()->with('propel')->begin()->check('MoviePropel', array(), 2)->check('MoviePropel', array('director' => 'Robert Aldrich', 'id' => 2))->check('MoviePropelI18N', array(), 4)->check('MoviePropelI18N', array('id' => 2), 2)->check('MoviePropelI18N', array('locale' => 'fr', 'id' => 2, 'title' => 'Les Douze Salopards'))->check('MoviePropelI18N', array('locale' => 'en', 'id' => 2, 'title' => 'The Dirty Dozen'))->end()->click('submit', array('movie_propel' => array('director' => 'Robert Aldrich (1)', 'en' => array('title' => 'The Dirty Dozen (1)'), 'fr' => array('title' => 'Les Douze Salopards (1)'))))->with('response')->begin()->isRedirected()->followRedirect()->end()->with('response')->begin()->checkElement('input[value="Robert Aldrich (1)"]')->checkElement('input[value="The Dirty Dozen (1)"]')->checkElement('input[value="Les Douze Salopards (1)"]')->end()->with('propel')->begin()->check('MoviePropel', array(), 2)->check('MoviePropel', array('director' => 'Robert Aldrich (1)', 'id' => 2))->check('MoviePropelI18N', array(), 4)->check('MoviePropelI18N', array('id' => 2), 2)->check('MoviePropelI18N', array('locale' => 'fr', 'id' => 2, 'title' => 'Les Douze Salopards (1)'))->check('MoviePropelI18N', array('locale' => 'en', 'id' => 2, 'title' => 'The Dirty Dozen (1)'))->end();
// https://github.com/propelorm/sfPropelORMPlugin/issues/38
// SfPropelBehaviorI18n (part of sfPropelORMPlugin)
$b->get('/i18n/movie')->with('request')->begin()->isParameter('module', 'i18n')->isParameter('action', 'movie')->end()->click('submit', array('movie' => array('director' => 'James McTeigue', 'en' => array('title' => 'V For Vendetta'), 'fr' => array('title' => 'V Pour Vendetta'), 'Toy' => array('newToy1' => array('ref' => '04212', 'en' => array('name' => 'V mask'), 'fr' => array('name' => 'masque de V'))))))->with('response')->begin()->isRedirected()->followRedirect()->end()->with('response')->begin()->checkElement('input[value="James McTeigue"]')->checkElement('input[value="V For Vendetta"]')->checkElement('input[value="V Pour Vendetta"]')->checkElement('input[name="movie[Toy][1][ref]"][value="04212"]')->checkElement('input[name="movie[Toy][1][en][name]"][value="V mask"]')->checkElement('input[name="movie[Toy][1][fr][name]"][value="masque de V"]')->end()->with('propel')->begin()->check('Movie', array(), 4)->check('Movie', array('director' => 'James McTeigue', 'id' => 4))->check('MovieI18N', array(), 8)->check('MovieI18N', array('id' => 4), 2)->check('MovieI18N', array('culture' => 'fr', 'id' => 4, 'title' => 'V Pour Vendetta'))->check('MovieI18N', array('culture' => 'en', 'id' => 4, 'title' => 'V For Vendetta'))->check('Toy', array(), 1)->check('Toy', array('ref' => '04212'))->check('ToyI18N', array(), 2)->check('ToyI18N', array('id' => 1), 2)->check('ToyI18N', array('culture' => 'fr', 'id' => 1, 'name' => 'masque de V'))->check('ToyI18N', array('culture' => 'en', 'id' => 1, 'name' => 'V mask'))->end();