Set minimum version to PHP 7.3
This commit is contained in:
parent
95c3be85c9
commit
8b467193d7
|
|
@ -12,7 +12,7 @@
|
|||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.2",
|
||||
"php": ">=7.3",
|
||||
"psr/http-factory": "~1.0",
|
||||
"psr/http-message": "~1.0",
|
||||
"psr/http-server-handler": "~1.0",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "041c27e394aba3e5c3bf6cbe8751f845",
|
||||
"content-hash": "bc05598d49e39b0082767d94ecb5bd4d",
|
||||
"packages": [
|
||||
{
|
||||
"name": "psr/http-factory",
|
||||
|
|
@ -4652,7 +4652,7 @@
|
|||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=7.2"
|
||||
"php": ">=7.3"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "1.1.0"
|
||||
|
|
|
|||
|
|
@ -25,8 +25,3 @@ services:
|
|||
volumes:
|
||||
- .:/usr/local/src/wellrested
|
||||
- ./docker/nginx/site.conf:/etc/nginx/conf.d/default.conf
|
||||
|
||||
php-fpm:
|
||||
image: php:7.4-fpm
|
||||
volumes:
|
||||
- .:/usr/local/src/wellrested
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ server {
|
|||
# PHP
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass php-fpm:9000;
|
||||
fastcgi_pass php:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_buffers 8 8k;
|
||||
fastcgi_buffer_size 16k;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
FROM php:7.4-cli
|
||||
FROM php:7.3-fpm
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get update && \
|
||||
|
|
@ -27,20 +27,18 @@ RUN mkdir /usr/local/src/wellrested && \
|
|||
chown -R www-data:www-data /usr/local/src/wellrested && \
|
||||
chown -R www-data:www-data /var/www
|
||||
|
||||
COPY ./src /usr/local/src/wellrested/src
|
||||
COPY ./test /usr/local/src/wellrested/test
|
||||
COPY ./composer.* /usr/local/src/wellrested/
|
||||
COPY ./phpunit.xml.dist /usr/local/src/wellrested/
|
||||
# Copy entrypoint script
|
||||
COPY docker/php/entrypoint /usr/local/bin
|
||||
|
||||
# Add symlinks for php-cs-fixer, phpunit, and psalm for easier running
|
||||
RUN ln -s /usr/local/src/wellrested/vendor/bin/php-cs-fixer /usr/local/bin/php-cs-fixer
|
||||
RUN ln -s /usr/local/src/wellrested/vendor/bin/phpunit /usr/local/bin/phpunit
|
||||
RUN ln -s /usr/local/src/wellrested/vendor/bin/psalm /usr/local/bin/psalm
|
||||
|
||||
ENTRYPOINT ["entrypoint"]
|
||||
|
||||
CMD ["php-fpm"]
|
||||
|
||||
WORKDIR /usr/local/src/wellrested
|
||||
|
||||
USER www-data
|
||||
|
||||
ENTRYPOINT ["dumb-init", "--"]
|
||||
|
||||
RUN composer install
|
||||
USER www-data
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run CLI commands with dumb-init to allow better signal handling.
|
||||
# Run PHP-FPM as PID 1.
|
||||
# https://engineeringblog.yelp.com/2016/01/dumb-init-an-init-for-docker.html
|
||||
if [ "$1" == 'php-fpm' ] ; then
|
||||
exec php-fpm
|
||||
else
|
||||
exec dumb-init -- "$@"
|
||||
fi
|
||||
|
|
@ -15,8 +15,9 @@ class StreamTest extends TestCase
|
|||
protected function setUp(): void
|
||||
{
|
||||
$this->resource = fopen('php://memory', 'w+');
|
||||
$this->resourceDevNull = fopen('/dev/null', 'r');
|
||||
$this->resourceDevNull = fopen('/dev/zero', 'r');
|
||||
fwrite($this->resource, $this->content);
|
||||
StreamHelper::$fail = false;
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
|
|
@ -105,7 +106,8 @@ class StreamTest extends TestCase
|
|||
|
||||
public function testTellThrowsRuntimeExceptionWhenUnableToReadStreamPosition(): void
|
||||
{
|
||||
$stream = new Stream($this->resourceDevNull);
|
||||
StreamHelper::$fail = true;
|
||||
$stream = new Stream($this->resource);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$stream->tell();
|
||||
}
|
||||
|
|
@ -135,7 +137,8 @@ class StreamTest extends TestCase
|
|||
|
||||
public function testSeekThrowsRuntimeExceptionWhenUnableToSeek(): void
|
||||
{
|
||||
$stream = new Stream($this->resourceDevNull);
|
||||
StreamHelper::$fail = true;
|
||||
$stream = new Stream($this->resource);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$stream->seek(10);
|
||||
}
|
||||
|
|
@ -150,7 +153,8 @@ class StreamTest extends TestCase
|
|||
|
||||
public function testRewindThrowsRuntimeExceptionWhenUnableToRewind(): void
|
||||
{
|
||||
$stream = new Stream($this->resourceDevNull);
|
||||
StreamHelper::$fail = true;
|
||||
$stream = new Stream($this->resource);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$stream->rewind();
|
||||
}
|
||||
|
|
@ -384,3 +388,37 @@ class StreamTest extends TestCase
|
|||
$this->assertNull($stream->getMetadata());
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Declare functions in this namespace so the class under test will use these
|
||||
// instead of the internal global functions during testing.
|
||||
|
||||
class StreamHelper
|
||||
{
|
||||
public static $fail = false;
|
||||
}
|
||||
|
||||
function fseek($resource, $offset, $whence = SEEK_SET)
|
||||
{
|
||||
if (StreamHelper::$fail) {
|
||||
return -1;
|
||||
}
|
||||
return \fseek($resource, $offset, $whence);
|
||||
}
|
||||
|
||||
function ftell($resource)
|
||||
{
|
||||
if (StreamHelper::$fail) {
|
||||
return false;
|
||||
}
|
||||
return \ftell($resource);
|
||||
}
|
||||
|
||||
function rewind($resource)
|
||||
{
|
||||
if (StreamHelper::$fail) {
|
||||
return false;
|
||||
}
|
||||
return \rewind($resource);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue