本文整理汇总了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());
}
示例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;
}
示例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));
}
示例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'));
}
}
示例5: testGetStatusCode
public function testGetStatusCode()
{
$this->driver->expects($this->once())->method('getStatusCode')->will($this->returnValue($ret = 404));
$this->assertEquals($ret, $this->session->getStatusCode());
}
示例6: _getResponseCode
public function _getResponseCode()
{
return $this->session->getStatusCode();
}
示例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())));
}