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


PHP sfTestBrowser::checkResponseElement方法代码示例

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


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

示例2: isRequestParameter

  isRequestParameter('module', 'agent')->
  isRequestParameter('action', 'list')->
  checkResponseElement('meta[content="text/html; charset=utf-8"]', true)->
  checkResponseElement('meta[content="text/css"]', true)->
  checkResponseElement('meta[content="en"]', true)->
  checkResponseElement('meta[name="robots"]', true)->
  checkResponseElement('meta[content="index,follow"]', true)->
  checkResponseElement('meta[name="description"]', true)->
  checkResponseElement('meta[name="keywords"]', true)->
  checkResponseElement('meta[name="language"]', true)->
  checkResponseElement('meta[content="en"]', true)->
  checkResponseElement('link[rel="shortcut icon"]', true)
;

//dynamic head settings
$browser->
  checkResponseElement('script[src="/sf/prototype/js/prototype.js"]', true)->
  checkResponseElement('script[src="/sf/prototype/js/builder.js"]', true)->
  checkResponseElement('script[src="/sf/prototype/js/effects.js"]', true)->
  checkResponseElement('link[href="/jpAdminPlugin/css/main.css"]', true)->
  checkResponseElement('link[href="/css/main.css"]', true)->
  checkResponseElement('link[href="/css/layout.css"]', true)->
  checkResponseElement('link[href="/css/agent/layout.css"]', true)
;

//admin sidebar
$browser->
  checkResponseElement('div#content_bar > div#panel_admin > h2', '/administration/')
;

//list
$browser->
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:32,代码来源:agentAdminActionsTest.php

示例3: isStatusCode

        //if it's forbidden
        $forwardTo = $actionArray['roles'][$role][$key]['forwardTo'];
        if (is_array($forwardTo))
        {
          //we should get forwarded to login
          $browser->
            isStatusCode(200)->
            isForwardedTo($forwardTo[0], $forwardTo[1])->
            isStatusCode(200)
            ;

           echo "\n******  Forbidden OK -- " . $role . " :: " . $key . " Access :: " . $action . "\n";
        }
        else if (isset($selectors))
        {

          // test everything for this role
          foreach ($selectors as $selector => $test)
          {
            $browser->checkResponseElement($test[0], $test[1]);
          }
        }
      }
    }

      //foreach $selectors as $selector => $test
        //checkResponseElement($test[0], $test[1], 'Checking -- ' . $selector)->
  }
}

开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:29,代码来源:agentActionsTest.php


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