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


PHP sfTestBrowser::setHttpHeader方法代码示例

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


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

示例1: get

$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->
开发者ID:nationalfield,项目名称:symfony,代码行数:31,代码来源:formatTest.php

示例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';
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

示例3: sfTestBrowser

/*
 * 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';
if (!(include dirname(__FILE__) . '/../bootstrap/functional.php')) {
    return;
}
$b = new sfTestBrowser();
$b->get('/format_test.js')->isStatusCode(200)->isRequestParameter('module', 'format')->isRequestParameter('action', 'index')->isRequestFormat('js')->isResponseHeader('content-type', 'application/javascript');
$b->test()->unlike($b->getResponse()->getContent(), '/<body>/', 'response content is ok');
$b->test()->like($b->getResponse()->getContent(), '/Some js headers/', 'response content is ok');
$b->test()->like($b->getResponse()->getContent(), '/This is a js file/', 'response content is ok');
$b->get('/format_test.css')->isStatusCode(200)->isRequestParameter('module', 'format')->isRequestParameter('action', 'index')->isRequestFormat('css')->isResponseHeader('content-type', 'text/css; charset=utf-8');
$b->test()->is($b->getResponse()->getContent(), 'This is a css file', 'response content is ok');
$b->get('/format_test')->isStatusCode(200)->isRequestParameter('module', 'format')->isRequestParameter('action', 'index')->isRequestFormat('html')->isResponseHeader('content-type', 'text/html; charset=utf-8')->checkResponseElement('body #content', 'This is an HTML file');
$b->get('/format_test.xml')->isStatusCode(200)->isRequestParameter('module', 'format')->isRequestParameter('action', 'index')->isRequestFormat('xml')->isResponseHeader('content-type', 'text/xml; charset=utf-8')->checkResponseElement('sentences sentence:first', 'This is a XML file');
$b->get('/format_test.foo')->isStatusCode(200)->isRequestParameter('module', 'format')->isRequestParameter('action', 'index')->isRequestFormat('foo')->isResponseHeader('content-type', 'text/html; charset=utf-8')->isResponseHeader('x-foo', 'true')->checkResponseElement('body #content', 'This is an HTML file');
$b->setHttpHeader('Accept', 'application/javascript')->get('/format/jsWithAccept')->isStatusCode(200)->isRequestParameter('module', 'format')->isRequestParameter('action', 'jsWithAccept')->isRequestFormat('js')->isResponseHeader('content-type', 'application/javascript');
$b->test()->like($b->getResponse()->getContent(), '/This is a js file/', 'response content is ok');
$b->get('/format/js')->isStatusCode(200)->isRequestParameter('module', 'format')->isRequestParameter('action', 'js')->isRequestFormat('js')->isResponseHeader('content-type', 'application/javascript');
$b->test()->is($b->getResponse()->getContent(), 'A js file', 'response content is ok');
$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')->isStatusCode(200)->isRequestParameter('module', 'format')->isRequestParameter('action', 'forTheIPhone')->isRequestFormat('iphone')->isResponseHeader('content-type', 'text/html; charset=utf-8')->checkResponseElement('#content', 'This is an HTML file for the iPhone')->checkResponseElement('link[href*="iphone.css"]');
$b->getAndCheck('format', 'throwsException', null, 500)->throwsException('Exception', '/message/');
$b->setHttpHeader('Accept', 'application/javascript')->getAndCheck('format', 'throwsException', null, 500)->isRequestFormat('js')->isResponseHeader('content-type', 'application/javascript')->throwsException('Exception', '/message/');
$b->test()->like($b->getResponse()->getContent(), '/Exception/', 'response is exception template');
$b->setHttpHeader('Accept', 'text/css')->getAndCheck('format', 'throwsNonDebugException', null, 500)->isRequestFormat('css')->isResponseHeader('content-type', 'text/css; charset=utf-8')->throwsException('Exception', '/message/');
$b->test()->unlike($b->getResponse()->getContent(), '/Exception/', 'response is error 500 template');
开发者ID:WIZARDISHUNGRY,项目名称:symfony,代码行数:31,代码来源:formatTest.php


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