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


PHP Session::getStatusCode方法代码示例

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


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

示例1: testBaseUrl

 public function testBaseUrl()
 {
     $client = new Client(require __DIR__ . '/../app.php');
     $driver = new BrowserKitDriver($client, 'http://localhost/foo/');
     $session = new Session($driver);
     $session->visit('http://localhost/foo/index.html');
     $this->assertEquals(200, $session->getStatusCode());
     $this->assertEquals('http://localhost/foo/index.html', $session->getCurrentUrl());
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:9,代码来源:BaseUrlTest.php

示例2: getResponseInfo

 /**
  * Returns response information string.
  *
  * @return  string
  */
 protected function getResponseInfo()
 {
     $driver = basename(str_replace('\\', '/', get_class($this->session->getDriver())));
     $info = '+--[ ';
     if (!in_array($driver, array('SahiDriver', 'SeleniumDriver'))) {
         $info .= 'HTTP/1.1 ' . $this->session->getStatusCode() . ' | ';
     }
     $info .= $this->session->getCurrentUrl() . ' | ' . $driver . " ]\n|\n";
     return $info;
 }
开发者ID:kingsj,项目名称:core,代码行数:15,代码来源:Exception.php

示例3: tryRecordTabsOnId

 /**
  * Test record tabs for a particular ID.
  *
  * @param Session $session  Session
  * @param string  $id       ID to load
  * @param bool    $encodeId Should we URL encode the ID?
  *
  * @return void
  */
 protected function tryRecordTabsOnId(Session $session, $id, $encodeId = true)
 {
     $url = $this->getVuFindUrl('/Record/' . ($encodeId ? rawurlencode($id) : $id));
     $session->visit($url);
     $this->assertEquals(200, $session->getStatusCode());
     $page = $session->getPage();
     $staffViewTab = $page->findById('details');
     $this->assertTrue(is_object($staffViewTab));
     $this->assertEquals('Staff View', $staffViewTab->getText());
     $staffViewTab->click();
     $this->assertEquals($url . '#details', $session->getCurrentUrl());
     $staffViewTable = $page->find('css', '#details-tab table.citation');
     $this->assertTrue(is_object($staffViewTable));
     $this->assertEquals('LEADER', substr($staffViewTable->getText(), 0, 6));
 }
开发者ID:joemontibello,项目名称:vufind,代码行数:24,代码来源:RecordTest.php

示例4: checkUserAccessToPages

 /**
  * @param $not
  * @param TableNode $paths
  *
  * @throws \Exception
  *
  * @Given /^user should(| not) have an access to the following pages:$/
  */
 public function checkUserAccessToPages($not, TableNode $paths)
 {
     $result = [];
     $code = $not ? 403 : 200;
     // Use "GoutteDriver" to have an ability to check answer code.
     $driver = new Mink\Driver\GoutteDriver();
     $session = new Mink\Session($driver);
     $session->start();
     foreach (array_keys($paths->getRowsHash()) as $path) {
         $path = trim($path, '/');
         $session->visit($this->locatePath($path));
         if ($session->getStatusCode() !== $code) {
             $result[] = $path;
         }
     }
     if (!empty($result)) {
         throw new \Exception(sprintf('The following paths: "%s" are %s accessible!', implode(', ', $result), $not ? '' : 'not'));
     }
 }
开发者ID:spheresh,项目名称:behat-drupal-propeople-context,代码行数:27,代码来源:RedirectContext.php

示例5: testGetStatusCode

 public function testGetStatusCode()
 {
     $this->driver->expects($this->once())->method('getStatusCode')->will($this->returnValue($ret = 404));
     $this->assertEquals($ret, $this->session->getStatusCode());
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:5,代码来源:SessionTest.php

示例6: _getResponseCode

 public function _getResponseCode()
 {
     return $this->session->getStatusCode();
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:4,代码来源:Mink.php

示例7: getNegativeFailureException

 /**
  * @param string $name
  * @param Session  $subject
  * @param array  $arguments
  *
  * @return FailureException
  */
 protected function getNegativeFailureException($name, $subject, array $arguments)
 {
     return new FailureException(sprintf('Expected session not to have status code %s, but it is.', $this->presenter->presentValue($subject->getStatusCode())));
 }
开发者ID:bravesheep,项目名称:phpspec-extra-matchers,代码行数:11,代码来源:StatusCodeMatcher.php


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