本文整理汇总了PHP中sfTestBrowser类的典型用法代码示例。如果您正苦于以下问题:PHP sfTestBrowser类的具体用法?PHP sfTestBrowser怎么用?PHP sfTestBrowser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfTestBrowser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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/');
}
开发者ID:TheProjecter,项目名称:myisern-lime,代码行数:8,代码来源:LoginSuccessTest.php
示例2: dirname
<?php
include dirname(__FILE__) . '/../../bootstrap/functional.php';
// create a new test browser
$browser = new sfTestBrowser();
$browser->get('/podcast_feed/index')->isStatusCode(200)->isRequestParameter('module', 'podcast_feed')->isRequestParameter('action', 'index')->checkResponseElement('body', '!/This is a temporary page/');
开发者ID:WIZARDISHUNGRY,项目名称:sflimetracker,代码行数:6,代码来源:podcast_feedActionsTest.php
示例3: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <[email protected]>
*
* 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->post('/fillInFilter/forward', array('name' => 'fabien'))->isStatusCode(200)->isRequestParameter('module', 'fillInFilter')->isRequestParameter('action', 'forward')->checkResponseElement('body div', 'foo');
$b->post('/fillInFilter/update', array('first_name' => 'fabien'))->isStatusCode(200)->isRequestParameter('module', 'fillInFilter')->isRequestParameter('action', 'update')->checkResponseElement('input[name="first_name"][value="fabien"]');
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:16,代码来源:fillInFilterTest.php
示例4: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) Fabien Potencier <[email protected]>
*
* 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();
// file upload
$fileToUpload = dirname(__FILE__) . '/fixtures/config/databases.yml';
$uploadedFile = sfConfig::get('sf_cache_dir') . '/uploaded.yml';
$name = 'test';
$b->get('/attachment/index')->with('request')->begin()->isParameter('module', 'attachment')->isParameter('action', 'index')->end()->with('response')->isStatusCode(200)->click('submit', array('attachment' => array('name' => $name, 'file' => $fileToUpload)))->with('response')->begin()->isRedirected()->followRedirect()->end()->with('response')->begin()->matches('/ok/')->end();
$b->test()->ok(file_exists($uploadedFile), 'file is uploaded');
$b->test()->is(file_get_contents($uploadedFile), file_get_contents($fileToUpload), 'file is correctly uploaded');
$c = new Criteria();
$c->add(AttachmentPeer::NAME, $name);
$attachments = AttachmentPeer::doSelect($c);
$b->test()->is(count($attachments), 1, 'the attachment has been saved in the database');
$b->test()->is($attachments[0]->getFile(), 'uploaded.yml', 'the attachment filename has been saved in the database');
@unlink($uploadedFile);
AttachmentPeer::doDeleteAll();
$b->test()->ok(!file_exists($uploadedFile), 'uploaded file is deleted');
// file upload in embedded form
开发者ID:cuongnv540,项目名称:jobeet,代码行数:31,代码来源:formTest.php
示例5: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <[email protected]>
*
* 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();
// default main page
$b->getAndCheck('default', 'index', '/')->with('response')->begin()->checkElement('body', '/congratulations/i')->checkElement('link[href="/sf/sf_default/css/screen.css"]')->checkElement('link[href="/css/main.css"]')->contains('<!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen" href="/css/ie6.css" /><![endif]-->')->end();
// default 404
$b->get('/nonexistant')->isStatusCode(404);
/*
$b->
get('/nonexistant/')->
isStatusCode(404)
;
*/
// 404 with ETag enabled must returns 404, not 304
sfConfig::set('sf_cache', true);
sfConfig::set('sf_etag', true);
$b->get('/notfound')->isStatusCode(404)->isRequestParameter('module', 'notfound')->isRequestParameter('action', 'index')->checkResponseElement('body', '/404/')->get('/notfound')->isStatusCode(404)->isRequestParameter('module', 'notfound')->isRequestParameter('action', 'index')->checkResponseElement('body', '/404/');
sfConfig::set('sf_cache', false);
sfConfig::set('sf_etag', false);
// unexistant action
开发者ID:bigcalm,项目名称:urlcatcher,代码行数:31,代码来源:genericTest.php
示例6: include
<?php
include(dirname(__FILE__).'/../../bootstrap/functional.php');
// create a new test browser
$browser = new sfTestBrowser();
$browser->initialize();
//$browser->
// get('/agent/list');
//$loggedIn = (false !== strpos($browser->getResponse()->getContent(),'sign out'));
//$loggedInAsAdmin = (false !== strpos($browser->getResponse()->getContent(),'admin profile'));
//if logged in as another user, sign out and login
//if logged in as admin, skip login
//if ($loggedIn && !$loggedInAsAdmin)
//{
// $browser->click('sign out');
//}
//if (!$loggedIn)
//{
$browser->
get('/login')->
isStatusCode(200);
$browser->post('/login', array(
'nickname' => 'admin',
'password' => 'admin',
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:31,代码来源:agentAdminActionsTest.php
示例7: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <[email protected]>
*
* 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();
// filter
$b->get('/filter')->isStatusCode(200)->isRequestParameter('module', 'filter')->isRequestParameter('action', 'index')->checkResponseElement('div[class="before"]', 1)->checkResponseElement('div[class="after"]', 1);
// filter with a forward in the same module
$b->get('/filter/indexWithForward')->isStatusCode(200)->isRequestParameter('module', 'filter')->isRequestParameter('action', 'indexWithForward')->checkResponseElement('div[class="before"]', 2)->checkResponseElement('div[class="after"]', 1);
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:19,代码来源:filterTest.php
示例8: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <[email protected]>
*
* 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->get('/autoload/myAutoload')->isStatusCode(200)->isRequestParameter('module', 'autoload')->isRequestParameter('action', 'myAutoload')->checkResponseElement('body div', 'foo');
$t = $b->test();
$t->ok(class_exists('BaseExtendMe'), 'plugin lib directory added to autoload');
$r = new ReflectionClass('ExtendMe');
$t->like($r->getFilename(), '~project/lib/ExtendMe~', 'plugin class can be replaced by project');
$t->ok(class_exists('NotInLib'), 'plugin autoload sets class paths');
$t->ok(!class_exists('ExcludedFromAutoload'), 'plugin autoload excludes directories');
开发者ID:mediasadc,项目名称:alba,代码行数:21,代码来源:autoloadTest.php
示例9: sfTestBrowser
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$app = 'backend_compat';
$fixtures = 'fixtures/fixtures.yml';
if (!include(dirname(__FILE__).'/../../bootstrap/functional.php'))
{
return;
}
$b = new sfTestBrowser();
// edit page
$b->
get('/validation/edit/id/1')->
isStatusCode(200)->
isRequestParameter('module', 'validation')->
isRequestParameter('action', 'edit')->
// parameters
isRequestParameter('id', 1)->
// save
click('save', array('article' => array('title' => '', 'body' => '')))->
isStatusCode(200)->
isRequestParameter('module', 'validation')->
开发者ID:nationalfield,项目名称:symfony,代码行数:31,代码来源:validationTest.php
示例10: 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]', '[email protected]')->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' => '[email protected]', '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');
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:26,代码来源:staticActionsTest.php
示例11: include
<?php
include(dirname(__FILE__).'/../../bootstrap/functional.php');
// create a new test browser
$browser = new sfTestBrowser();
$browser->initialize();
$browser->
get('/concept/index')->
isStatusCode(200)->
isRequestParameter('module', 'concept')->
isRequestParameter('action', 'index')->
checkResponseElement('body', '!/This is a temporary page/')
;
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:15,代码来源:conceptActionsTest.php
示例12: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <[email protected]>
*
* 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();
// exceptions
$b->get('/exception/noException')->isStatusCode(200)->isRequestParameter('module', 'exception')->isRequestParameter('action', 'noException')->responseContains('foo')->get('/exception/throwsException')->isStatusCode(200)->isRequestParameter('module', 'exception')->isRequestParameter('action', 'throwsException')->throwsException('Exception')->throwsException('Exception', 'Exception message')->throwsException('Exception', '/message/')->throwsException(null, '!/sfException/')->get('/exception/throwsSfException')->isStatusCode(200)->isRequestParameter('module', 'exception')->isRequestParameter('action', 'throwsSfException')->throwsException('sfException')->throwsException('sfException', 'sfException message');
$b->get('/browser')->responseContains('html')->checkResponseElement('h1', 'html')->get('/browser/text')->responseContains('text');
try {
$b->checkResponseElement('h1', 'text');
$b->test()->fail('The DOM is not accessible if the response content type is not HTML');
} catch (sfException $e) {
$b->test()->pass('The DOM is not accessible if the response content type is not HTML');
}
// check response headers
$b->get('/browser/responseHeader')->isStatusCode()->isResponseHeader('content-type', 'text/plain; charset=utf-8')->isResponseHeader('foo', 'bar')->isResponseHeader('foo', 'foobar');
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:26,代码来源:sfTestBrowserTest.php
示例13: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <[email protected]>
*
* 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->get('/autoload/myAutoload')->with('request')->begin()->isParameter('module', 'autoload')->isParameter('action', 'myAutoload')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body div', 'foo')->end();
$t = $b->test();
$t->ok(class_exists('BaseExtendMe'), 'plugin lib directory added to autoload');
$r = new ReflectionClass('ExtendMe');
$t->like(str_replace(DIRECTORY_SEPARATOR, '/', $r->getFilename()), '~fixtures/lib/ExtendMe~', 'plugin class can be replaced by project');
$t->ok(class_exists('NotInLib'), 'plugin autoload sets class paths');
$t->ok(!class_exists('ExcludedFromAutoload'), 'plugin autoload excludes directories');
开发者ID:sabaki-dev,项目名称:symfony1,代码行数:21,代码来源:autoloadTest.php
示例14: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <[email protected]>
*
* 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->get('/escaping/on')->with('request')->begin()->isParameter('module', 'escaping')->isParameter('action', 'on')->end()->with('response')->begin()->isStatusCode(200)->matches('#<h1>Lorem <strong>ipsum</strong> dolor sit amet.</h1>#')->matches('#<h2>Lorem <strong>ipsum</strong> dolor sit amet.</h2>#')->matches('#<h3>Lorem <strong>ipsum</strong> dolor sit amet.</h3>#')->matches('#<h4>Lorem <strong>ipsum</strong> dolor sit amet.</h4>#')->matches('#<h5>Lorem <strong>ipsum</strong> dolor sit amet.</h5>#')->matches('#<h6>Lorem <strong>ipsum</strong> dolor sit amet.</h6>#')->checkElement('span.no', 2)->end();
$b->get('/escaping/off')->with('request')->begin()->isParameter('module', 'escaping')->isParameter('action', 'off')->end()->with('response')->begin()->isStatusCode(200)->matches('#<h1>Lorem <strong>ipsum</strong> dolor sit amet.</h1>#')->matches('#<h2>Lorem <strong>ipsum</strong> dolor sit amet.</h2>#')->end();
开发者ID:sensorsix,项目名称:app,代码行数:16,代码来源:escapingTest.php
示例15: sfDatabaseManager
require_once $sf_root_dir . '/test/bootstrap/functional.php';
require_once $sf_symfony_lib_dir . '/vendor/lime/lime.php';
if (!defined('TEST_CLASS') || !class_exists(TEST_CLASS) || !defined('TEST_CLASS_2') || !class_exists(TEST_CLASS_2)) {
// Don't run tests
return;
}
// initialize database manager
$databaseManager = new sfDatabaseManager();
$databaseManager->initialize();
$con = Propel::getConnection();
// clean the database
TagPeer::doDeleteAll();
TaggingPeer::doDeleteAll();
call_user_func(array(_create_object()->getPeer(), 'doDeleteAll'));
// create a new test browser
$browser = new sfTestBrowser();
$browser->initialize();
// start tests
$t = new lime_test(66, new lime_output_color());
// these tests check for the tags attachement consistency
$t->diag('tagging consistency');
$object = _create_object();
$t->ok($object->getTags() == array(), 'a new object has no tag.');
$object->addTag('toto');
$object_tags = $object->getTags();
$t->ok(count($object_tags) == 1 && $object_tags['toto'] == 'toto', 'a non-saved object can get tagged.');
$object->addTag('toto');
$object_tags = $object->getTags();
$t->ok(count($object_tags) == 1, 'a tag is only applied once to non-saved objects.');
$object->save();
$object->addTag('toto');
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:31,代码来源:deppPropelActAsTaggableBehaviorTest.php
示例16: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <[email protected]>
*
* 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"]');
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:31,代码来源:genericTest.php
示例17: sfTestBrowser
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$app = 'i18n';
if (!include(dirname(__FILE__).'/../bootstrap/functional.php'))
{
return;
}
$b = new sfTestBrowser();
// default culture (en)
$b->
get('/en/i18n/i18nForm')->
with('request')->begin()->
isParameter('module', 'i18n')->
isParameter('action', 'i18nForm')->
end()->
with('user')->isCulture('en')->
with('response')->begin()->
isStatusCode(200)->
checkElement('label', 'First name', array('position' => 0))->
checkElement('label', 'Last name', array('position' => 1))->
checkElement('label', 'Email address', array('position' => 2))->
checkElement('td', '/Put your first name here/i', array('position' => 0))->
开发者ID:nationalfield,项目名称:symfony,代码行数:30,代码来源:i18nFormTest.php
示例18: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <[email protected]>
*
* 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();
// filter
$b->get('/filter')->with('request')->begin()->isParameter('module', 'filter')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('div[class="before"]', 1)->checkElement('div[class="after"]', 1)->end();
// filter with a forward in the same module
$b->get('/filter/indexWithForward')->with('request')->begin()->isParameter('module', 'filter')->isParameter('action', 'indexWithForward')->end()->with('response')->begin()->isStatusCode(200)->checkElement('div[class="before"]', 2)->checkElement('div[class="after"]', 1)->end();
开发者ID:sensorsix,项目名称:app,代码行数:18,代码来源:filterTest.php
示例19: define
<?php
define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/../../../..'));
define('SF_APP', 'frontend');
include dirname(__FILE__) . '/../../../../test/bootstrap/functional.php';
$b = new sfTestBrowser();
$b->initialize();
$t = new lime_test(15, new lime_output_color());
$enclosureParams = array('url' => 'foo.com', 'length' => '1234', 'mimeType' => 'foobarmimetype');
$enclosure = new sfFeedEnclosure();
$enclosure->initialize($enclosureParams);
$item_params = array('title' => 'foo', 'link' => 'http://www.example.com', 'description' => 'foobar baz', 'content' => 'hey, do you foo, bar?', 'authorName' => 'francois', 'authorEmail' => '[email protected]', 'authorLink' => 'http://francois.toto.com', 'pubDate' => '12345', 'comments' => 'this is foo bar baz', 'uniqueId' => 'hello world', 'enclosure' => $enclosure, 'categories' => array('foo', 'bar'));
$item = new sfFeedItem();
$t->isa_ok($item->initialize($item_params), 'sfFeedItem', 'initialize() returns the current feed item object');
$t->is($item->getTitle(), $item_params['title'], 'getTitle() gets the item title');
$t->is($item->getLink(), $item_params['link'], 'getLink() gets the item link');
$t->is($item->getDescription(), $item_params['description'], 'getDescription() gets the item description');
$t->is($item->getContent(), $item_params['content'], 'getContent() gets the item content');
$t->is($item->getAuthorName(), $item_params['authorName'], 'getAuthorName() gets the item author name');
$t->is($item->getAuthorEmail(), $item_params['authorEmail'], 'getAuthorEmail() gets the item author email');
$t->is($item->getAuthorLink(), $item_params['authorLink'], 'getAuthorLink() gets the item author link');
$t->is($item->getPubDate(), $item_params['pubDate'], 'getPubDate() gets the item publication date');
$t->is($item->getComments(), $item_params['comments'], 'getComments() gets the item comments');
$t->is($item->getUniqueId(), $item_params['uniqueId'], 'getUniqueId() gets the item unique id');
$t->is($item->getEnclosure(), $item_params['enclosure'], 'getEnclosure() gets the item enclosure');
$t->is($item->getCategories(), $item_params['categories'], 'getCategories() gets the item categories');
$item_params = array('title' => 'foo', 'link' => 'http://www.example.com', 'content' => 'hey, do you <strong>foo</strong>, my dear bar?');
$item = new sfFeedItem();
$item->initialize($item_params);
$t->is($item->getDescription(), strip_tags($item_params['content']), 'getDescription() gets the stripped item content when no description is defined');
sfConfig::set('app_feed_item_max_length', 5);
开发者ID:runopencode,项目名称:diem-extended,代码行数:31,代码来源:sfFeedItemTest.php
示例20: sfTestBrowser
<?php
/*
* This file is part of the symfony package.
* (c) Fabien Potencier <[email protected]>
*
* 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->get('/format_test.js')->with('request')->begin()->isParameter('module', 'format')->isParameter('action', 'index')->isFormat('js')->end()->with('response')->begin()->isStatusCode(200)->isHeader('content-type', 'application/javascript')->matches('!/<body>/')->matches('/Some js headers/')->matches('/This is a js file/')->end();
$b->get('/format_test.css')->with('request')->begin()->isParameter('module', 'format')->isParameter('action', 'index')->isFormat('css')->end()->with('response')->begin()->isStatusCode(200)->isHeader('content-type', 'text/css; charset=utf-8')->matches('/This is a css file/')->end();
$b->get('/format_test')->with('request')->begin()->isParameter('module', 'format')->isParameter('action', 'index')->isFormat('html')->end()->with('response')->begin()->isStatusCode(200)->isHeader('content-type', 'text/html; charset=utf-8')->checkElement('body #content', 'This is an HTML file')->end();
$b->get('/format_test.xml')->with('request')->begin()->isParameter('module', 'format')->isParameter('action', 'index')->isFormat('xml')->end()->with('response')->begin()->isStatusCode(200)->isHeader('content-type', 'text/xml; charset=utf-8')->checkElement('sentences sentence:first', 'This is a XML file')->end();
$b->get('/format_test.foo')->with('request')->begin()->isParameter('module', 'format')->isParameter('action', 'index')->isFormat('foo')->end()->with('response')->begin()->isStatusCode(200)->isHeader('content-type', 'text/html; charset=utf-8')->isHeader('x-foo', 'true')->checkElement('body #content', 'This is an HTML file')->end();
$b->get('/format/js')->with('request')->begin()->isParameter('module', 'format')->isParameter('action', 'js')->isFormat('js')->end()->with('response')->begin()->isStatusCode(200)->isHeader('content-type', 'application/javascript')->matches('/A js file/')->end();
$b->setHttpHeader('User-Agent', 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3')->get('/format/forTheIPhone')->with('request')->begin()->isParameter('module', 'format')->isParameter('action', 'forTheIPhone')->isFormat('iphone')->end()->with('response')->begin()->isStatusCode(200)->isHeader('content-type', 'text/html; charset=utf-8')->checkElement('#content', 'This is an HTML file for the iPhone')->checkElement('link[href*="iphone.css"]')->end();
$b->getAndCheck('format', 'throwsException', null, 500)->throwsException('Exception', '/message/');
开发者ID:sensorsix,项目名称:app,代码行数:22,代码来源:formatTest.php
注:本文中的sfTestBrowser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论