當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。