-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from oleksandr-gribiennikov-paysera/EC-966
EC-966: set default value for the $message
- Loading branch information
Showing
16 changed files
with
202 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
BASE_CONTAINER='<paysera internal container name>' | ||
APACHE_RUN_USER= | ||
APACHE_RUN_GROUP= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
supervisor.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
ARG BASE_CONTAINER | ||
FROM ${BASE_CONTAINER} | ||
|
||
ARG BASE_CONTAINER | ||
ENV BASE_CONTAINER ${BASE_CONTAINER} | ||
|
||
ARG APACHE_RUN_USER | ||
ENV APACHE_RUN_USER ${APACHE_RUN_USER} | ||
|
||
ARG APACHE_RUN_GROUP | ||
ENV APACHE_RUN_GROUP ${APACHE_RUN_GROUP} | ||
|
||
RUN apt update \ | ||
&& apt install -y mc | ||
|
||
RUN composer self-update --2 | ||
|
||
RUN php=$(echo "${BASE_CONTAINER}" | sed -nE 's/.*php-([0-9]+\.[0-9]+).*/\1/p') \ | ||
&& echo "xdebug.mode=develop,debug,coverage" >> /etc/php/${php}/mods-available/xdebug.ini | ||
|
||
RUN sed -iE "s/^export APACHE_RUN_USER=.*$/export APACHE_RUN_USER=${APACHE_RUN_USER}/g" /etc/apache2/envvars \ | ||
&& sed -iE "s/^export APACHE_RUN_GROUP=.*$/export APACHE_RUN_GROUP=${APACHE_RUN_GROUP}/g" /etc/apache2/envvars | ||
|
||
RUN phpenmod xdebug | ||
|
||
RUN usermod -a -G 1000 www-data | ||
RUN usermod -a -G 1000 mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[supervisord] | ||
nodaemon=true | ||
[program:apache2] | ||
command = /usr/sbin/apache2ctl -DFOREGROUND | ||
user = root | ||
autostart = false | ||
stdout_events_enabled = true | ||
stderr_events_enabled = true | ||
[program:php-fpm] | ||
command = /usr/sbin/php-fpm7.4 --nodaemonize | ||
user = root | ||
autostart = true | ||
stdout_events_enabled = true | ||
stderr_events_enabled = true | ||
[program:redis] | ||
command = /usr/bin/redis-server | ||
user = root | ||
autostart = false | ||
stdout_events_enabled = true | ||
stderr_events_enabled = true | ||
[program:mysql] | ||
command = /bin/bash -c "service mysql start && sleep 100" | ||
user = root | ||
autostart = false | ||
stdout_events_enabled = true | ||
stderr_events_enabled = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,9 @@ composer.lock | |
vendor/ | ||
bin/ | ||
.arcconfig | ||
.phpunit.result.cache | ||
dump.rdb | ||
|
||
coverage/ | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## Local deployment for development and/or running tests | ||
|
||
1. Run: | ||
- cp .docker/supervisor.conf.dist .docker/supervisor.conf | ||
- cp .dist.env .env | ||
|
||
Set environment values inside the `.env`.\ | ||
Also configure `supervisor`'s options if you need. By default no services autostart but that's enough to run tests. | ||
\ | ||
Then: | ||
- docker-compose build | ||
- docker-compose up -d --remove-orphans | ||
|
||
2. Check: | ||
- docker ps | grep lib-rest-client-common\ | ||
You should see an output similar to this:\ | ||
` | ||
1a7b71f2d8f9 lib-rest-client-common-lib "/usr/bin/supervisord" 21 minutes ago Up 21 minutes rest-client-common | ||
` | ||
3. Enter the container:\ | ||
`docker exec -it lib-rest-client-common bash`\ | ||
and run inside:\ | ||
`composer i` | ||
|
||
5. Run tests:\ | ||
`bin/phpunit` | ||
6. Enjoy your work! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: '3' | ||
|
||
services: | ||
lib: | ||
container_name: rest-client-common | ||
build: | ||
context: . | ||
dockerfile: .docker/Dockerfile | ||
args: | ||
- BASE_CONTAINER=${BASE_CONTAINER} | ||
- APACHE_RUN_USER=${APACHE_RUN_USER} | ||
- APACHE_RUN_GROUP=${APACHE_RUN_GROUP} | ||
volumes: | ||
- ./:/home/app/src | ||
- ./.docker/supervisor.conf:/etc/supervisor/conf.d/supervisor.conf | ||
extra_hosts: | ||
- host.docker.internal:host-gateway |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Paysera\Component\RestClientCommon\Tests\Exception; | ||
|
||
use GuzzleHttp\Psr7\Response; | ||
use Paysera\Component\RestClientCommon\Exception\RequestException; | ||
use PHPUnit\Framework\Error\Deprecated; | ||
use PHPUnit\Framework\TestCase; | ||
use Psr\Http\Message\RequestInterface; | ||
|
||
class RequestExceptionTest extends TestCase | ||
{ | ||
|
||
public function test__construct() | ||
{ | ||
$requestMock = $this->createMock(RequestInterface::class); | ||
$responseMock = new Response(200, [], 'some body'); | ||
|
||
$errorReporting = error_reporting(); | ||
|
||
error_reporting(-1); | ||
|
||
try { | ||
RequestException::create($requestMock, $responseMock); | ||
|
||
$this->assertTrue(true); | ||
} catch (Deprecated $exception) { | ||
$this->assertEquals( | ||
'Exception::__construct(): Passing null to parameter #1 ($message) of type string is deprecated', | ||
$exception->getMessage() | ||
); | ||
$this->fail($exception->getMessage()); | ||
} finally { | ||
error_reporting($errorReporting); | ||
} | ||
} | ||
} |