Skip to content

Commit ba19a94

Browse files
committed
Initial import
1 parent eafaa13 commit ba19a94

File tree

7 files changed

+1043
-0
lines changed

7 files changed

+1043
-0
lines changed

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)