Skip to content

Commit cffd416

Browse files
committed
Merge pull request #1 from php-http/initial_import
Initial import
2 parents eafaa13 + 7050059 commit cffd416

File tree

9 files changed

+996
-2
lines changed

9 files changed

+996
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Boilerplate Adapter
1+
# Http adapter integration tests
22

33
[![Latest Version](https://img.shields.io/github/release/php-http/adapter-integration-tests.svg?style=flat-square)](https://github.com/php-http/adapter-integration-tests/releases)
44
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
],
1313
"require": {
1414
"php": ">=5.4",
15-
"phpunit/phpunit": "~4.4",
15+
"phpunit/phpunit": "~4.4"
1616
},
1717
"require-dev": {
1818
"php-http/adapter-core": "dev-initial_import"

fixture/files/file1.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
foo

fixture/files/file2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bar

fixture/files/file3.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
baz

fixture/files/resource.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
abcdefghijklmnopqrstuvwxyz

fixture/server.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Http Adapter package.
5+
*
6+
* (c) Eric GELOEN <[email protected]>
7+
*
8+
* For the full copyright and license information, please read the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
require_once __DIR__.'/../src/PHPUnitUtility.php';
13+
14+
use Http\Adapter\Tests\PHPUnitUtility;
15+
16+
$file = fopen(PHPUnitUtility::getFile(true, 'ivory-http-adapter.log'), 'c');
17+
flock($file, LOCK_EX);
18+
ftruncate($file, 0);
19+
20+
$serverError = isset($_GET['server_error']) ? $_GET['server_error'] : false;
21+
$clientError = isset($_GET['client_error']) ? $_GET['client_error'] : false;
22+
$delay = isset($_GET['delay']) ? $_GET['delay'] : 0;
23+
$redirect = isset($_GET['redirect']) ? $_GET['redirect'] : false;
24+
25+
if ($serverError) {
26+
header($_SERVER['SERVER_PROTOCOL'].' 500 Internal Server Error', true, 500);
27+
}
28+
29+
if ($clientError) {
30+
header($_SERVER['SERVER_PROTOCOL'].' 400 Bad Request', true, 400);
31+
}
32+
33+
if ($delay > 0) {
34+
usleep($delay * 1000000);
35+
}
36+
37+
if ($redirect) {
38+
header($_SERVER['SERVER_PROTOCOL'].' 302 Found', true, 302);
39+
header('Location: http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']);
40+
echo 'Redirect';
41+
} else {
42+
echo 'Ok';
43+
}
44+
45+
fwrite(
46+
$file,
47+
json_encode(array(
48+
'SERVER' => $_SERVER,
49+
'GET' => $_GET,
50+
'POST' => $_POST,
51+
'FILES' => $_FILES,
52+
'INPUT' => file_get_contents('php://input'),
53+
))
54+
);
55+
56+
fflush($file);
57+
flock($file, LOCK_UN);
58+
fclose($file);

0 commit comments

Comments
 (0)