composer update
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
.idea
|
||||
.DS_store
|
||||
/vendor/
|
||||
composer.phar
|
||||
composer.lock
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
|
||||
before_script:
|
||||
- composer install
|
||||
|
||||
script:
|
||||
- mkdir -p build/logs
|
||||
- php vendor/bin/phpunit -c phpunit.xml
|
||||
|
||||
after_script:
|
||||
- php vendor/bin/coveralls -v
|
||||
+8
@@ -14,6 +14,14 @@ This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/f
|
||||
|
||||
## Install
|
||||
|
||||
For PHP version **`>= 5.6`**:
|
||||
|
||||
```
|
||||
composer require ralouphie/getallheaders
|
||||
```
|
||||
|
||||
For PHP version **`< 5.6`**:
|
||||
|
||||
```
|
||||
composer require ralouphie/getallheaders "^2"
|
||||
```
|
||||
|
||||
+9
-4
@@ -9,13 +9,18 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3"
|
||||
"php": ">=5.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~3.7.0",
|
||||
"satooshi/php-coveralls": ">=1.0"
|
||||
"phpunit/phpunit": "^5 || ^6.5",
|
||||
"php-coveralls/php-coveralls": "^2.1"
|
||||
},
|
||||
"autoload": {
|
||||
"files": ["src/getallheaders.php"]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"getallheaders\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
<phpunit
|
||||
bootstrap="vendor/autoload.php"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
strict="true">
|
||||
|
||||
<testsuite>
|
||||
<directory>./tests</directory>
|
||||
</testsuite>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
|
||||
<logging>
|
||||
<log type="coverage-clover" target="build/logs/clover.xml"/>
|
||||
</logging>
|
||||
|
||||
</phpunit>
|
||||
@@ -1,121 +0,0 @@
|
||||
<?php
|
||||
|
||||
class GetAllHeadersTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @dataProvider testWorksData
|
||||
*/
|
||||
public function testWorks($test_type, $expected, $server)
|
||||
{
|
||||
foreach ($server as $key => $val) {
|
||||
$_SERVER[$key] = $val;
|
||||
}
|
||||
$result = getallheaders();
|
||||
$this->assertEquals($expected, $result, "Error testing $test_type works.");
|
||||
}
|
||||
|
||||
public function testWorksData()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'normal case',
|
||||
array(
|
||||
'Key-One' => 'foo',
|
||||
'Key-Two' => 'bar',
|
||||
'Another-Key-For-Testing' => 'baz'
|
||||
),
|
||||
array(
|
||||
'HTTP_KEY_ONE' => 'foo',
|
||||
'HTTP_KEY_TWO' => 'bar',
|
||||
'HTTP_ANOTHER_KEY_FOR_TESTING' => 'baz'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'Content-Type',
|
||||
array(
|
||||
'Content-Type' => 'two'
|
||||
),
|
||||
array(
|
||||
'HTTP_CONTENT_TYPE' => 'one',
|
||||
'CONTENT_TYPE' => 'two'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'Content-Length',
|
||||
array(
|
||||
'Content-Length' => '222'
|
||||
),
|
||||
array(
|
||||
'CONTENT_LENGTH' => '222',
|
||||
'HTTP_CONTENT_LENGTH' => '111'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'Content-Length (HTTP_CONTENT_LENGTH only)',
|
||||
array(
|
||||
'Content-Length' => '111'
|
||||
),
|
||||
array(
|
||||
'HTTP_CONTENT_LENGTH' => '111'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'Content-MD5',
|
||||
array(
|
||||
'Content-Md5' => 'aef123'
|
||||
),
|
||||
array(
|
||||
'CONTENT_MD5' => 'aef123',
|
||||
'HTTP_CONTENT_MD5' => 'fea321'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'Content-MD5 (HTTP_CONTENT_MD5 only)',
|
||||
array(
|
||||
'Content-Md5' => 'f123'
|
||||
),
|
||||
array(
|
||||
'HTTP_CONTENT_MD5' => 'f123'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'Authorization (normal)',
|
||||
array(
|
||||
'Authorization' => 'testing'
|
||||
),
|
||||
array(
|
||||
'HTTP_AUTHORIZATION' => 'testing',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'Authorization (redirect)',
|
||||
array(
|
||||
'Authorization' => 'testing redirect'
|
||||
),
|
||||
array(
|
||||
'REDIRECT_HTTP_AUTHORIZATION' => 'testing redirect',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'Authorization (PHP_AUTH_USER + PHP_AUTH_PW)',
|
||||
array(
|
||||
'Authorization' => 'Basic ' . base64_encode('foo:bar')
|
||||
),
|
||||
array(
|
||||
'PHP_AUTH_USER' => 'foo',
|
||||
'PHP_AUTH_PW' => 'bar'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'Authorization (PHP_AUTH_DIGEST)',
|
||||
array(
|
||||
'Authorization' => 'example-digest'
|
||||
),
|
||||
array(
|
||||
'PHP_AUTH_DIGEST' => 'example-digest'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user