当前位置: 首页>>代码示例>>PHP>>正文


PHP sfTestBrowser::setCookie方法代码示例

本文整理汇总了PHP中sfTestBrowser::setCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP sfTestBrowser::setCookie方法的具体用法?PHP sfTestBrowser::setCookie怎么用?PHP sfTestBrowser::setCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfTestBrowser的用法示例。


在下文中一共展示了sfTestBrowser::setCookie方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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();
// exceptions
$b->get('/exception/noException')->isStatusCode(200)->isRequestParameter('module', 'exception')->isRequestParameter('action', 'noException')->responseContains('foo')->get('/exception/throwsException')->isStatusCode(500)->isRequestParameter('module', 'exception')->isRequestParameter('action', 'throwsException')->throwsException('Exception')->get('/exception/throwsException')->isStatusCode(500)->isRequestParameter('module', 'exception')->isRequestParameter('action', 'throwsException')->throwsException('Exception', '/Exception message/')->get('/exception/throwsException')->isStatusCode(500)->isRequestParameter('module', 'exception')->isRequestParameter('action', 'throwsException')->throwsException('Exception', '/message/')->get('/exception/throwsException')->isStatusCode(500)->isRequestParameter('module', 'exception')->isRequestParameter('action', 'throwsException')->throwsException(null, '!/sfException/')->get('/exception/throwsSfException')->isStatusCode(500)->isRequestParameter('module', 'exception')->isRequestParameter('action', 'throwsSfException')->throwsException('sfException')->get('/exception/throwsSfException')->isStatusCode(500)->isRequestParameter('module', 'exception')->isRequestParameter('action', 'throwsSfException')->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 (LogicException $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()->with('response')->begin()->isHeader('content-type', 'text/plain; charset=utf-8')->isHeader('content-type', '#text/plain#')->isHeader('content-type', '!#text/html#')->isHeader('foo', 'bar')->isHeader('foo', 'foobar')->end();
// cookies
$b->setCookie('foo', 'bar')->setCookie('bar', 'foo')->setCookie('foofoo', 'foo', time() - 10)->get('/cookie')->with('request')->begin()->hasCookie('foofoo', false)->hasCookie('foo')->isCookie('foo', 'bar')->isCookie('foo', '/a/')->isCookie('foo', '!/z/')->end()->checkResponseElement('p', 'bar.foo-')->get('/cookie')->with('request')->begin()->hasCookie('foo')->isCookie('foo', 'bar')->isCookie('foo', '/a/')->isCookie('foo', '!/z/')->end()->checkResponseElement('p', 'bar.foo-')->removeCookie('foo')->get('/cookie')->with('request')->begin()->hasCookie('foo', false)->hasCookie('bar')->end()->checkResponseElement('p', '.foo-')->clearCookies()->get('/cookie')->with('request')->begin()->hasCookie('foo', false)->hasCookie('bar', false)->end()->checkResponseElement('p', '.-');
$b->setCookie('foo', 'bar')->setCookie('bar', 'foo')->get('/cookie/setCookie')->get('/cookie')->with('request')->begin()->hasCookie('foo')->isCookie('foo', 'bar')->isCookie('foo', '/a/')->isCookie('foo', '!/z/')->end()->checkResponseElement('p', 'bar.foo-barfoo')->get('/cookie')->with('request')->begin()->hasCookie('foo')->isCookie('foo', 'bar')->isCookie('foo', '/a/')->isCookie('foo', '!/z/')->end()->checkResponseElement('p', 'bar.foo-barfoo')->removeCookie('foo')->get('/cookie')->with('request')->begin()->hasCookie('foo', false)->hasCookie('bar')->end()->checkResponseElement('p', '.foo-barfoo')->get('/cookie/removeCookie')->get('/cookie')->with('request')->begin()->hasCookie('foo', false)->hasCookie('bar')->end()->checkResponseElement('p', '.foo-')->get('/cookie/setCookie')->clearCookies()->get('/cookie')->with('request')->begin()->hasCookie('foo', false)->hasCookie('bar', false)->end()->checkResponseElement('p', '.-');
$b->get('/browser')->with('request')->isMethod('get')->post('/browser')->with('request')->isMethod('post')->call('/browser', 'put')->with('request')->isMethod('put');
// sfBrowser: clean the custom view templates
$b->get('/browser/templateCustom')->checkResponseElement('#test', 'template')->get('/browser/templateCustom/custom/1')->checkResponseElement('#test', 'template 1')->get('/browser/templateCustom')->checkResponseElement('#test', 'template');
开发者ID:mediasadc,项目名称:alba,代码行数:31,代码来源:sfTestBrowserTest.php


注:本文中的sfTestBrowser::setCookie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。