本文整理汇总了PHP中xdebug_get_headers函数的典型用法代码示例。如果您正苦于以下问题:PHP xdebug_get_headers函数的具体用法?PHP xdebug_get_headers怎么用?PHP xdebug_get_headers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xdebug_get_headers函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testRespondsPlainTextWithHttpCode404
/**
* @runInSeparateProcess
*/
public function testRespondsPlainTextWithHttpCode404()
{
(new NotFound())->respond();
$this->assertContains('Content-Type: text/plain; charset=utf-8', xdebug_get_headers());
$this->assertEquals(Http::NOT_FOUND, http_response_code());
$this->expectOutputString('Not Found.');
}
开发者ID:fortuneglobe,项目名称:icehawk,代码行数:10,代码来源:NotFoundTest.php
示例2: test_send_headers
public function test_send_headers()
{
SecureHeaders::fromFile($this->configPath)->send();
$headers = xdebug_get_headers();
$this->assertContains('X-Content-Type-Options: nosniff', $headers);
$this->assertContains('Referrer-Policy: strict-origin-when-cross-origin', $headers);
}
开发者ID:BePsvPT,项目名称:laravel-security-header,代码行数:7,代码来源:SecureHeadersTest.php
示例3: testRespondsPlainTextWithHttpCode401
/**
* @runInSeparateProcess
*/
public function testRespondsPlainTextWithHttpCode401()
{
(new Unauthorized())->respond();
$this->assertContains('Content-Type: text/plain; charset=utf-8', xdebug_get_headers());
$this->assertEquals(Http::UNAUTHORIZED, http_response_code());
$this->expectOutputString('Unauthorized.');
}
开发者ID:fortuneglobe,项目名称:icehawk,代码行数:10,代码来源:UnauthorizedTest.php
示例4: testRespondsPlainTextWithHttpCode403
/**
* @runInSeparateProcess
*/
public function testRespondsPlainTextWithHttpCode403()
{
(new Forbidden())->respond();
$this->assertContains('Content-Type: text/plain; charset=utf-8', xdebug_get_headers());
$this->assertEquals(Http::FORBIDDEN, http_response_code());
$this->expectOutputString("Forbidden!");
}
开发者ID:fortuneglobe,项目名称:icehawk,代码行数:10,代码来源:ForbiddenTest.php
示例5: testSendsLocationAndHttpCodeHeaderWhenResponding
/**
* @runInSeparateProcess
* @dataProvider locationCodeProvider
*/
public function testSendsLocationAndHttpCodeHeaderWhenResponding($location, $httpCode, $expectedHeader, $expectedCode)
{
$redirect = new Redirect($location, $httpCode);
$redirect->respond();
$this->assertContains($expectedHeader, xdebug_get_headers());
$this->assertEquals($expectedCode, http_response_code());
}
开发者ID:fortuneglobe,项目名称:icehawk,代码行数:11,代码来源:RedirectTest.php
示例6: testRespondsPlainTextWithHttpCode405
/**
* @runInSeparateProcess
*/
public function testRespondsPlainTextWithHttpCode405()
{
(new MethodNotAllowed())->respond();
$this->assertContains('Content-Type: text/plain; charset=utf-8', xdebug_get_headers());
$this->assertEquals(Http::METHOD_NOT_ALLOWED, http_response_code());
$this->expectOutputString('Method not allowed.');
}
开发者ID:fortuneglobe,项目名称:icehawk,代码行数:10,代码来源:MethodNotAllowedTest.php
示例7: testProtectedController
/**
* @runInSeparateProcess
* @outputBuffering disabled
*/
public function testProtectedController()
{
if (!function_exists('xdebug_get_headers')) {
$this->markTestSkipped('Xdebug not installed');
}
$autoloader = new Autoloader();
$autoloader->register();
$autoloader->addNamespaces([['Linna\\FOO', dirname(__DIR__) . '/FOO']]);
//config options
$session = new Session();
$session->start();
$password = new Password();
$storedPassword = $password->hash('password');
//attemp first login
$login = new Login($session, $password);
$login->login('root', 'password', $storedUser = 'root', $storedPassword, 1);
$loginLogged = $login->logged;
$model = new FOOModel();
$controller1 = new FOOProtectedController($model, $login);
$controllerTest1 = $controller1->test;
$login->logout();
$loginNoLogged = $login->logged;
ob_start();
$controller2 = new FOOProtectedController($model, $login);
$headers_list = xdebug_get_headers();
ob_end_clean();
$this->assertEquals(true, $loginLogged);
$this->assertEquals(false, $loginNoLogged);
$this->assertEquals(true, $controllerTest1);
$this->assertEquals(true, in_array('Location: http://localhost', $headers_list));
$session->destroy();
}
开发者ID:s3b4stian,项目名称:framework,代码行数:36,代码来源:ProtectedControllerTest.php
示例8: testRespondsPlainTextWithHttpCode500
/**
* @runInSeparateProcess
*/
public function testRespondsPlainTextWithHttpCode500()
{
(new InternalServerError())->respond();
$this->assertContains('Content-Type: text/plain; charset=utf-8', xdebug_get_headers());
$this->assertEquals(Http::INTERNAL_SERVER_ERROR, http_response_code());
$this->expectOutputString("Internal server error.");
}
开发者ID:fortuneglobe,项目名称:icehawk,代码行数:10,代码来源:InternalServerErrorTest.php
示例9: shouldShowCaptcha
/**
* @test
*/
public function shouldShowCaptcha()
{
$this->oneClickCaptchaService->showCaptcha();
$headers = xdebug_get_headers();
$this->assertEquals("Expires: Thu, 19 Nov 1981 08:52:00 GMT", $headers[1]);
$this->assertEquals("Pragma: public", $headers[2]);
$this->assertEquals("Cache-Control: public", $headers[3]);
}
开发者ID:krowinski,项目名称:one-click-captcha,代码行数:11,代码来源:OneClickCaptchaServiceTest.php
示例10: testHeader
/**
* コンテンツタイプを出力
*
* @return void
*/
public function testHeader()
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
$this->BcMobile->header();
$result = xdebug_get_headers();
$expected = 'Content-type: application/xhtml+xml';
$this->assertEquals($expected, $result[0]);
}
开发者ID:baserproject,项目名称:basercms,代码行数:13,代码来源:BcMobileHelperTest.php
示例11: testResponseObjectReturnsAllowedHeaderWhenWrongMethodUsed
/**
* @runInSeparateProcess
*/
public function testResponseObjectReturnsAllowedHeaderWhenWrongMethodUsed()
{
$request = $this->container['request'];
$request->setSupportedRequestMethods(array($request::POST, $request::PUT, $request::DELETE));
$response = $this->container['response'];
$this->response->send($response::METHOD_NOT_ALLOWED_CODE);
$this->assertContains('Allow: POST, PUT, DELETE', xdebug_get_headers());
}
开发者ID:andrii-maglovanyi,项目名称:rest-service,代码行数:11,代码来源:ResponseTest.php
示例12: testRespondsPlainTextWithHttpCode400
/**
* @runInSeparateProcess
*/
public function testRespondsPlainTextWithHttpCode400()
{
$messages = ['This is a unit test.', 'I am testing the output.'];
(new BadRequest($messages))->respond();
$this->assertContains('Content-Type: text/plain; charset=utf-8', xdebug_get_headers());
$this->assertEquals(Http::BAD_REQUEST, http_response_code());
$this->expectOutputString("This is a unit test.\nI am testing the output.");
}
开发者ID:fortuneglobe,项目名称:icehawk,代码行数:11,代码来源:BadRequestTest.php
示例13: testJson
/**
* @runInSeparateProcess
*/
public function testJson()
{
$response = new Response($this->makeRequest());
$response->setJson(['a' => 'b']);
$this->expectOutputString(json_encode(['a' => 'b', 'c' => 'd']));
$response->json(['c' => 'd']);
$this->assertContains('Content-type: application/json', xdebug_get_headers());
}
开发者ID:ansarbek,项目名称:beaver-mysql-logger,代码行数:11,代码来源:ResponseTest.php
示例14: testRespondsJsonWithHttpCode500
/**
* @runInSeparateProcess
*/
public function testRespondsJsonWithHttpCode500()
{
$messages = ['This is a unit test.', 'I am testing the output.'];
(new BadJsonRequest($messages))->respond();
$this->assertContains('Content-Type: application/json; charset=utf-8', xdebug_get_headers());
$this->assertEquals(Http::BAD_REQUEST, http_response_code());
$this->expectOutputString('{"messages":["This is a unit test.","I am testing the output."]}');
}
开发者ID:fortuneglobe,项目名称:icehawk,代码行数:11,代码来源:BadJsonRequestTest.php
示例15: testHeaderResponseAttributes
/**
* @test
* @requires PHP > 5.3
* @runInSeparateProcess
*/
public function testHeaderResponseAttributes()
{
$this->qrCode->setFormat('png')->setHeaderResponse();
$this->assertEquals(['Content-Type: image/png'], \xdebug_get_headers());
$this->qrCode->setFormat('jpg')->setHeaderResponse();
$this->assertEquals(['Content-Type: image/jpeg'], \xdebug_get_headers());
$this->qrCode->setFormat('gif')->setHeaderResponse();
$this->assertEquals(['Content-Type: image/gif'], \xdebug_get_headers());
}
开发者ID:scada-josh,项目名称:rmr,代码行数:14,代码来源:QrCodeTest.php
示例16: doTest
public static function doTest($response)
{
$writer = new ezcMvcHttpResponseWriter($response);
ob_start();
$writer->handleResponse();
$contents = ob_get_contents();
ob_end_clean();
return array(xdebug_get_headers(), $contents);
}
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:9,代码来源:http.php
示例17: testHeader
/**
* @covers ::Header
* @runInSeparateProcess
*/
public function testHeader()
{
$header = 'a test header';
ob_start();
$this->assertEquals($this->testObj, $this->testObj->Header($header));
$headers = xdebug_get_headers();
ob_end_clean();
$this->assertContains($header, $headers);
}
开发者ID:rakelley,项目名称:jhframe,代码行数:13,代码来源:IoTest.php
示例18: testSendsRedirectLocationHeader
/**
* @runInSeparateProcess
*/
public function testSendsRedirectLocationHeader()
{
if (!function_exists('xdebug_get_headers')) {
$this->markTestSkipped('Requires ext/xdebug to be installed.');
}
$this->redirector->redirect('http://www.example.com');
$this->assertContains('Location: http://www.example.com/', xdebug_get_headers());
header_remove();
}
开发者ID:emma5021,项目名称:toba,代码行数:12,代码来源:RedirectorTest.php
示例19: testRedirect
/**
* @runInSeparateProcess
*/
public function testRedirect()
{
$data = array('name' => 'foo', 'email' => '[email protected]', 'message' => 'baz');
$this->cb_args = array();
$kontact = new Kontact($this->schema, $this->cb);
$kontact->process($data, 'qux');
$this->assertEquals(array('Location: qux?err=0&data%5Bname%5D=foo&data%5Bemail%5D=foo%40bar.com&data%5Bmessage%5D=baz'), xdebug_get_headers());
$this->assertEquals(array(0, $data), $this->cb_args);
}
开发者ID:yuanqing,项目名称:kontact,代码行数:12,代码来源:KontactTest.php
示例20: testSendMessageGzipCompression
public function testSendMessageGzipCompression()
{
$communication = new PluginFusioninventoryCommunication();
$communication->setMessage('<foo><bar/></foo>');
$this->expectOutputString(gzencode($this->output));
$communication->sendMessage('gzip');
$headers = xdebug_get_headers();
$this->assertContains('Content-Type: application/x-compress-gzip', $headers);
}
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:9,代码来源:CommunicationTest.php
注:本文中的xdebug_get_headers函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论