Update composer, phpunit configuration, and remove apache_request_headers
This commit is contained in:
parent
408d82fb73
commit
8c4b59c525
|
|
@ -16,7 +16,7 @@
|
||||||
"psr/http-message": "dev-master"
|
"psr/http-message": "dev-master"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "4.5.x"
|
"phpunit/phpunit": "~4.6"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "825703713a0e0eab25f1de28f7cc1c33",
|
"hash": "008c17b77c590b88be5f76a2ca05f37f",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "psr/http-message",
|
"name": "psr/http-message",
|
||||||
|
|
@ -281,31 +281,33 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-file-iterator",
|
"name": "phpunit/php-file-iterator",
|
||||||
"version": "1.3.4",
|
"version": "1.4.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
||||||
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb"
|
"reference": "a923bb15680d0089e2316f7a4af8f437046e96bb"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb",
|
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb",
|
||||||
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb",
|
"reference": "a923bb15680d0089e2316f7a4af8f437046e96bb",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.3"
|
"php": ">=5.3.3"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.4.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
"classmap": [
|
||||||
"File/"
|
"src/"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"include-path": [
|
|
||||||
""
|
|
||||||
],
|
|
||||||
"license": [
|
"license": [
|
||||||
"BSD-3-Clause"
|
"BSD-3-Clause"
|
||||||
],
|
],
|
||||||
|
|
@ -322,7 +324,7 @@
|
||||||
"filesystem",
|
"filesystem",
|
||||||
"iterator"
|
"iterator"
|
||||||
],
|
],
|
||||||
"time": "2013-10-10 15:34:57"
|
"time": "2015-04-02 05:19:05"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-text-template",
|
"name": "phpunit/php-text-template",
|
||||||
|
|
@ -463,16 +465,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "4.5.1",
|
"version": "4.6.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4"
|
"reference": "163232991e652e6efed2f8470326fffa61e848e2"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d6429b0995b24a2d9dfe5587ee3a7071c1161af4",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/163232991e652e6efed2f8470326fffa61e848e2",
|
||||||
"reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4",
|
"reference": "163232991e652e6efed2f8470326fffa61e848e2",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
|
@ -484,17 +486,17 @@
|
||||||
"php": ">=5.3.3",
|
"php": ">=5.3.3",
|
||||||
"phpspec/prophecy": "~1.3,>=1.3.1",
|
"phpspec/prophecy": "~1.3,>=1.3.1",
|
||||||
"phpunit/php-code-coverage": "~2.0,>=2.0.11",
|
"phpunit/php-code-coverage": "~2.0,>=2.0.11",
|
||||||
"phpunit/php-file-iterator": "~1.3.2",
|
"phpunit/php-file-iterator": "~1.4",
|
||||||
"phpunit/php-text-template": "~1.2",
|
"phpunit/php-text-template": "~1.2",
|
||||||
"phpunit/php-timer": "~1.0.2",
|
"phpunit/php-timer": "~1.0",
|
||||||
"phpunit/phpunit-mock-objects": "~2.3",
|
"phpunit/phpunit-mock-objects": "~2.3",
|
||||||
"sebastian/comparator": "~1.1",
|
"sebastian/comparator": "~1.1",
|
||||||
"sebastian/diff": "~1.1",
|
"sebastian/diff": "~1.2",
|
||||||
"sebastian/environment": "~1.2",
|
"sebastian/environment": "~1.2",
|
||||||
"sebastian/exporter": "~1.2",
|
"sebastian/exporter": "~1.2",
|
||||||
"sebastian/global-state": "~1.0",
|
"sebastian/global-state": "~1.0",
|
||||||
"sebastian/version": "~1.0",
|
"sebastian/version": "~1.0",
|
||||||
"symfony/yaml": "~2.0"
|
"symfony/yaml": "~2.1|~3.0"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"phpunit/php-invoker": "~1.1"
|
"phpunit/php-invoker": "~1.1"
|
||||||
|
|
@ -505,7 +507,7 @@
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "4.5.x-dev"
|
"dev-master": "4.6.x-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
|
@ -531,7 +533,7 @@
|
||||||
"testing",
|
"testing",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
"time": "2015-03-29 09:24:05"
|
"time": "2015-04-11 05:23:21"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit-mock-objects",
|
"name": "phpunit/phpunit-mock-objects",
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<phpdoc>
|
|
||||||
<title>WellRESTed</title>
|
|
||||||
<parser>
|
|
||||||
<target>phpdoc</target>
|
|
||||||
<markers>
|
|
||||||
<item>TODO</item>
|
|
||||||
<item>FIXME</item>
|
|
||||||
</markers>
|
|
||||||
</parser>
|
|
||||||
<transformer>
|
|
||||||
<target>phpdoc</target>
|
|
||||||
</transformer>
|
|
||||||
<transformations>
|
|
||||||
<template name="responsive" />
|
|
||||||
</transformations>
|
|
||||||
<files>
|
|
||||||
<directory>src</directory>
|
|
||||||
<ignore>test/*</ignore>
|
|
||||||
</files>
|
|
||||||
</phpdoc>
|
|
||||||
|
|
@ -11,26 +11,14 @@
|
||||||
syntaxCheck="false"
|
syntaxCheck="false"
|
||||||
verbose="true"
|
verbose="true"
|
||||||
>
|
>
|
||||||
<php>
|
|
||||||
<!-- Port for testing the Client class. Set this to a port that is not used on the system.
|
|
||||||
Use a range (e.g., 2000-9000) to randomly pick a port within the boundaries.
|
|
||||||
To override, "export PORT=8081"
|
|
||||||
-->
|
|
||||||
<env name="PORT" value="2000-9000" />
|
|
||||||
<!-- Port for testing Client class failuers. Set this to a port that is not used on the system. -->
|
|
||||||
<env name="FAIL_PORT" value="9001-9100" />
|
|
||||||
</php>
|
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="unit">
|
<testsuite name="unit">
|
||||||
<directory>./test/tests/unit/</directory>
|
<directory>./test/tests/unit</directory>
|
||||||
</testsuite>
|
|
||||||
<testsuite name="integration">
|
|
||||||
<directory>./test/tests/integration/</directory>
|
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
<filter>
|
<filter>
|
||||||
<whitelist>
|
<whitelist>
|
||||||
<directory suffix=".php">./src/</directory>
|
<directory suffix=".php">./src</directory>
|
||||||
</whitelist>
|
</whitelist>
|
||||||
</filter>
|
</filter>
|
||||||
<logging>
|
<logging>
|
||||||
|
|
|
||||||
|
|
@ -354,11 +354,6 @@ class ServerRequest extends Request implements ServerRequestInterface
|
||||||
*/
|
*/
|
||||||
protected function getServerRequestHeaders()
|
protected function getServerRequestHeaders()
|
||||||
{
|
{
|
||||||
// Prefer apache_request_headers is available.
|
|
||||||
if (function_exists("apache_request_headers")) {
|
|
||||||
return apache_request_headers();
|
|
||||||
}
|
|
||||||
|
|
||||||
// http://www.php.net/manual/en/function.getallheaders.php#84262
|
// http://www.php.net/manual/en/function.getallheaders.php#84262
|
||||||
$headers = array();
|
$headers = array();
|
||||||
foreach ($_SERVER as $name => $value) {
|
foreach ($_SERVER as $name => $value) {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a dummy apache_request_headers method in the global namesapce.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!function_exists("apache_request_headers")) {
|
|
||||||
function apache_request_headers() {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -286,42 +286,6 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertEquals("Bear", $attributes["dog"]);
|
$this->assertEquals("Bear", $attributes["dog"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers WellRESTed\Message\ServerRequest::getServerRequestHeaders
|
|
||||||
* @runInSeparateProcess
|
|
||||||
* @preserveGlobalState disabled
|
|
||||||
*/
|
|
||||||
public function testReadsApacheRequestHeaders()
|
|
||||||
{
|
|
||||||
// This file adds a dummy apache_request_headers in the global namespace.
|
|
||||||
require_once(__DIR__ . "/../../../src/apache_request_headers.php");
|
|
||||||
|
|
||||||
$_SERVER = [
|
|
||||||
"HTTP_HOST" => "localhost",
|
|
||||||
"HTTP_ACCEPT" => "application/json",
|
|
||||||
"QUERY_STRING" => "guinea_pig=Claude&hamster=Fizzgig"
|
|
||||||
];
|
|
||||||
$_COOKIE = [
|
|
||||||
"cat" => "Molly"
|
|
||||||
];
|
|
||||||
$_FILES = [
|
|
||||||
"file" => [
|
|
||||||
"name" => "MyFile.jpg",
|
|
||||||
"type" => "image/jpeg",
|
|
||||||
"tmp_name" => "/tmp/php/php6hst32",
|
|
||||||
"error" => "UPLOAD_ERR_OK",
|
|
||||||
"size" => 98174
|
|
||||||
]
|
|
||||||
];
|
|
||||||
$_POST = [
|
|
||||||
"dog" => "Bear"
|
|
||||||
];
|
|
||||||
|
|
||||||
$request = ServerRequest::getServerRequest();
|
|
||||||
$headers = $request->getHeaders();
|
|
||||||
$this->assertNotNull($headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::readFromServerRequest
|
* @covers WellRESTed\Message\ServerRequest::readFromServerRequest
|
||||||
* @preserveGlobalState disabled
|
* @preserveGlobalState disabled
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue