Commit 16d32e3a authored by TheBigB's avatar TheBigB
Browse files

Testing something

parent 1f35bec9
Pipeline #127181827 passed with stage
in 2 minutes and 12 seconds
test:5.6:
image: 1of0/php-ci:5.6-httpbin
stages:
- test
test:7.2:
image: php:7.2-cli
stage: test
script:
- composer install --ignore-platform-reqs
- vendor/bin/phpunit --configuration phpunit.xml
- bash ci/prepare-test.sh > /dev/null
- composer install
- vendor/bin/phpunit --configuration ci/phpunit.xml --coverage-text --colors=never
test:7.0:
image: 1of0/php-ci:7.0-httpbin
test:7.3:
image: php:7.3-cli
stage: test
script:
- composer install --ignore-platform-reqs
- vendor/bin/phpunit --configuration phpunit.xml
- bash ci/prepare-test.sh > /dev/null
- composer install
- vendor/bin/phpunit --configuration ci/phpunit.xml --coverage-text --colors=never
coverage:
image: 1of0/php-ci:7.0-httpbin
test:7.4:
image: php:7.4-cli
stage: test
script:
- composer install --ignore-platform-reqs
- vendor/bin/phpunit --coverage-text --colors=never --configuration phpunit.xml
- bash ci/prepare-test.sh > /dev/null
- composer install
- vendor/bin/phpunit --configuration ci/phpunit.xml --coverage-text --colors=never
<phpunit bootstrap="vendor/autoload.php">
<phpunit bootstrap="../vendor/autoload.php">
<testsuites>
<testsuite name="Curly">
<directory>tests</directory>
<directory>../tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
<directory suffix=".php">../src</directory>
<exclude>
<directory>src/Exceptions</directory>
<directory>../src/Exceptions</directory>
</exclude>
</whitelist>
</filter>
......
#!/bin/bash
[[ ! -e /.dockerenv ]] && exit 0
set -xe
apt-get update -yqq
apt-get install git libzip-dev zip curl libffi-dev python-pip python-dev gunicorn -yqq
pip install --upgrade cffi
pip install httpbin
pecl install xdebug-2.9.3
docker-php-ext-install zip
docker-php-ext-enable xdebug
curl --location --output /usr/local/bin/composer https://getcomposer.org/composer-stable.phar
chmod +x /usr/local/bin/composer
......@@ -5,14 +5,17 @@
"license": "MIT",
"require":
{
"php": ">=5.5.0",
"php": ">=5.6.0",
"ext-json": "*",
"ext-curl": "*",
"psr/http-message": "^1.0",
"1of0/streams": "^0.1.3",
"zendframework/zend-diactoros": "^1.1.0"
},
"require-dev":
{
"phpunit/phpunit": "^5.0.0"
"roave/security-advisories": "dev-master",
"phpunit/phpunit": "^5.0.0"
},
"autoload":
{
......
This diff is collapsed.
......@@ -59,10 +59,8 @@ class BinarySafe
}
return $length;
}
else
{
return strlen($input);
}
return strlen($input);
}
/**
......@@ -89,14 +87,9 @@ class BinarySafe
return mb_substr($input, $start, $length, '8bit');
}
if (isset($length))
{
return substr($input, $start, $length);
}
else
{
return substr($input, $start);
}
return isset($length)
? substr($input, $start, $length)
: substr($input, $start);
}
/**
......
......@@ -9,6 +9,7 @@
namespace OneOfZero\Curly;
use OneOfZero\Curly\Exceptions\CurlException;
use OneOfZero\Curly\Handlers\AbstractHandler;
use OneOfZero\Streams\SharedStreamInterface;
use Psr\Http\Message\RequestInterface;
......@@ -93,7 +94,11 @@ class Curly implements HttpClientInterface
$options->apply($channel);
curl_exec($channel);
$result = curl_exec($channel);
if ($result === false) {
throw new CurlException(curl_error($channel), curl_errno($channel));
}
if ($responseStream !== null && $responseStream->isSeekable())
{
......@@ -124,10 +129,8 @@ class Curly implements HttpClientInterface
$options->outputHeaderStream = $stream;
return new Stream($stream);
}
else
{
return new Stream($options->outputHeaderStream);
}
return new Stream($options->outputHeaderStream);
}
/**
......@@ -150,10 +153,8 @@ class Curly implements HttpClientInterface
$options->outputStream = $stream;
return new Stream($stream);
}
else
{
return new Stream($options->outputStream);
}
return new Stream($options->outputStream);
}
/**
......@@ -243,7 +244,7 @@ class Curly implements HttpClientInterface
continue;
}
list($name, $value) = explode(':', $line, 2);
[$name, $value] = explode(':', $line, 2);
$normalizedName = strtolower($name);
$value = trim($value, "\t ");
......
<?php
namespace OneOfZero\Curly\Exceptions;
use RuntimeException;
class CurlException extends RuntimeException
{
}
......@@ -148,7 +148,7 @@ class StreamHandler extends CancellableHandler
}
// Don't forward 100 status responses
if (strpos($headerData, '100 Continue') !== false)
if (stripos($headerData, '100 Continue') !== false)
{
return parent::onHeader($channel, $headerData);
}
......@@ -170,7 +170,6 @@ class StreamHandler extends CancellableHandler
header($header, false);
return parent::onHeader($channel, $headerData);
}
/**
......
......@@ -29,4 +29,4 @@ class SharedStream extends Stream implements SharedStreamInterface
{
return $this->resource;
}
}
\ No newline at end of file
}
......@@ -48,7 +48,11 @@ class Bootstrapper
$pipes = [];
$this->port = intval(shell_exec('((netstat -atn | awk \'{printf "%s\n%s\n", $4, $4}\' | grep -oE \'[0-9]*$\'; seq 32768 61000) | sort -n | uniq -u | head -n 1) 2> /dev/null'));
$process = proc_open("gunicorn httpbin:app -b \"127.0.0.1:{$this->port}\" 2> /dev/null", [], $pipes);
$process = proc_open(
"gunicorn httpbin:app -b \"127.0.0.1:{$this->port}\"",
[],
$pipes
);
$this->pid = intval(proc_get_status($process)['pid']);
sleep(2);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment