本文整理汇总了PHP中sfTestBrowser::getContext方法的典型用法代码示例。如果您正苦于以下问题:PHP sfTestBrowser::getContext方法的具体用法?PHP sfTestBrowser::getContext怎么用?PHP sfTestBrowser::getContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfTestBrowser
的用法示例。
在下文中一共展示了sfTestBrowser::getContext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContext
public function getContext($forceReload = false)
{
parent::getContext($forceReload);
sfPropel::initialize($this->context->getEventDispatcher());
return $this->context;
}
示例2: realpath
* For the full copyright and license information, please view the LICENSE.yahoo
* file that was distributed with this source code.
*/
$sf_symfony_lib_dir = '/Users/dustin/projects/symfony/branch/1.1/lib';
$sf_root_dir = realpath(dirname(__FILE__) . '/../fixtures/project');
require_once $sf_root_dir . '/config/ProjectConfiguration.class.php';
$configuration = sfProjectConfiguration::getApplicationConfiguration('dimensions', 'test', true, $sf_root_dir);
sfContext::createInstance($configuration);
$sf_symfony_lib_dir = sfConfig::get('sf_symfony_lib_dir');
// remove all cache
sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir'));
// load lime
require_once $configuration->getSymfonyLibDir() . '/vendor/lime/lime.php';
$b = new sfTestBrowser();
$t = $b->test();
$c = $b->getContext()->getConfiguration();
$t->diag('checking default configuration dimensions');
$b->get('/test2')->isStatusCode(200)->checkResponseElement('title', '/symfony project/')->checkResponseElement('body', '/generic view/')->checkResponseElement('body', '/generic action/');
$t->is($c->getConfigPaths('config/app.yml'), array($sf_root_dir . '/apps/dimensions/config/app.yml', $sf_root_dir . '/apps/dimensions/config/sp1/app.yml'), '->getConfigPaths() returns correct module level configuration files given name');
$t->is($c->getTemplatePath('test', 'indexSuccess.php'), $sf_root_dir . '/apps/dimensions/modules/test/templates/indexSuccess.php', '->getTemplatePath() returns correct path to template given module name and template name');
$t->diag('checking backwards compatability by setting dimension null');
$c->setDimension(null);
$t->is($c->getTemplateDirs('test'), array($sf_root_dir . '/apps/dimensions/modules/test/templates', $sf_root_dir . '/plugins/ysfDimensionsTestPlugin/modules/test/templates', $sf_symfony_lib_dir . '/controller/test/templates', $sf_root_dir . '/cache/dimensions/test/modules/autoTest/templates'), '->getTemplateDirs() checking template path returns correct with out dimension');
$t->is($c->getConfigPaths('modules/test/config/view.yml'), array($sf_symfony_lib_dir . '/config/config/view.yml', $sf_root_dir . '/apps/dimensions/config/view.yml', $sf_root_dir . '/plugins/ysfDimensionsTestPlugin/modules/test/config/view.yml', $sf_root_dir . '/apps/dimensions/modules/test/config/view.yml'), '->getConfigPaths() checking template path returns correct with out dimension');
$b->get('/test2')->isStatusCode(200)->checkResponseElement('title', '/symfony project/')->checkResponseElement('body', '/generic view/')->checkResponseElement('body', '/generic action/');
// setup 1st test dimension
$c->setDimension(array('culture' => 'fr', 'skin' => 'corp', 'host' => 'sp1'));
$t->diag('checking all project level configuration methods return correct paths with dimensions');
// ysfProjectConfiguration
// model
$t->is($c->getModelDirs(), array($sf_root_dir . '/lib/model/fr', $sf_root_dir . '/lib/model', $sf_root_dir . '/plugins/ysfDimensionsTestPlugin/lib/model/fr', $sf_root_dir . '/plugins/ysfDimensionsTestPlugin/lib/model'), '->getModelDirs() return correct directory cascade with dimensions');
示例3: with
with('request')->begin()->
isParameter('module', 'invoice')->
isParameter('action', 'index')->
end()->
with('response')->begin()->
isStatusCode(200)->
checkElement('body', '!/This is a temporary page/')->
end()
;
*/
$b = new sfTestBrowser();
$b->initialize();
$b->get('/customer/new')->setField('customer[name]', 'dummy')->click('Save')->with('response')->begin()->isRedirected()->followRedirect()->end()->with('request')->begin()->isParameter('name', 'dummy')->isParameter('module', 'customer')->isParameter('action', 'edit')->end();
$request = $b->getRequest();
$context = $b->getContext();
$response = $b->getResponse();
foreach ($request as $key => $value) {
echo $key . "=>" . $value;
}
/*
//--------------------calling pages--------------------
// Create a new test browser
$b = new sfTestBrowser();
$b->initialize();
$b->get('/foobar/show/id/1'); // GET request
$b->post('/foobar/show', array('id' => 1)); // POST request
// The get() and post() methods are shortcuts to the call() method
$b->call('/foobar/show/id/1', 'get');