Skip to content

Commit

Permalink
Merge pull request #3 from php-api-clients/improvement-handle-disconn…
Browse files Browse the repository at this point in the history
…ects-and-reconnect-when-appropriate

Improvement handle disconnects and reconnect when appropriate
  • Loading branch information
WyriHaximus authored May 23, 2017
2 parents b42dfd3 + 6a1c7fa commit ebd3a03
Show file tree
Hide file tree
Showing 25 changed files with 1,869 additions and 482 deletions.
21 changes: 21 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php declare(strict_types=1);

use ApiClients\Tools\TestUtilities\PhpCsFixerConfig;

return (function ()
{
$path = __DIR__ . DIRECTORY_SEPARATOR;
$paths = [
$path . 'src',
$path . 'tests',
];

return PhpCsFixerConfig::create()
->setFinder(
PhpCsFixer\Finder::create()
->in($paths)
->append($paths)
)
->setUsingCache(false)
;
})();
42 changes: 28 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,51 @@ cache:
directories:
- $HOME/.composer/cache/files

## PHP versions we test against
php:
- 7.0
- 7.1
- nightly

## Build matrix for lowest and highest possible targets
matrix:
include:
- php: 7.0
env: dependencies=lowest
env:
- qaExtended=true
- php: 7.1
- php: nightly
env:
- dropPlatform=false
- php: 7.0
env:
- dependencies=lowest
- php: 7.1
env: dependencies=lowest
env:
- dependencies=lowest
- php: nightly
env: dependencies=lowest
env:
- dependencies=lowest
- dropPlatform=false
- php: 7.0
env: dependencies=highest
env:
- dependencies=highest
- php: 7.1
env: dependencies=highest
env:
- dependencies=highest
- php: nightly
env: dependencies=highest
env:
- dependencies=highest
- dropPlatform=false

## Install or update dependencies
install:
- composer validate
- if [ -z "$dropPlatform" ]; then composer config --unset platform.php; fi;
- if [ -z "$qaExtended" ]; then phpenv config-rm xdebug.ini || :; fi;
- if [ -z "$dependencies" ]; then composer install --prefer-dist; fi;
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest --prefer-dist -n; fi;
- if [ "$dependencies" = "highest" ]; then composer update --prefer-dist -n; fi;
- composer show

## Run the actual test
script: make travis
script:
- if [ -z "$qaExtended" ]; then make ci; fi;
- if [ "$qaExtended" = "true" ]; then make ci-extended; fi;

## Gather coverage and set it to coverage servers
after_script: make travis-coverage
after_script: if [ "$qaExtended" = "true" ]; then make ci-coverage; fi;
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Cees-Jan Kiewiet
Copyright (c) 2017 Cees-Jan Kiewiet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
38 changes: 26 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
all: cs unit
travis: cs travis-unit
contrib: cs unit
all:
composer run-script qa-all --timeout=0

all-coverage:
composer run-script qa-all-coverage --timeout=0

ci:
composer run-script qa-ci --timeout=0

ci-extended:
composer run-script qa-ci-extended --timeout=0

contrib:
composer run-script qa-contrib --timeout=0

init:
if [ ! -d vendor ]; then composer install; fi;
composer ensure-installed

cs:
composer cs

cs: init
./vendor/bin/phpcs --standard=PSR2 src/
cs-fix:
composer cs-fix

unit: init
./vendor/bin/phpunit --coverage-text --coverage-html covHtml
unit:
composer run-script unit --timeout=0

travis-unit: init
./vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml
unit-coverage:
composer run-script unit-coverage --timeout=0

travis-coverage: init
if [ -f ./build/logs/clover.xml ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi
ci-coverage: init
composer ci-coverage
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

The MIT License (MIT)

Copyright (c) 2016 Cees-Jan Kiewiet
Copyright (c) 2017 Cees-Jan Kiewiet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 3 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ environment:
- dependencies: highest
php_ver_target: 7.1

## Cache composer bits
## Cache composer, chocolatey and php bits
cache:
- '%LOCALAPPDATA%\Composer\files -> composer.lock'

Expand All @@ -33,7 +33,7 @@ init:
## Install PHP and composer, and run the appropriate composer command
install:
- IF EXIST c:\tools\php (SET PHP=0)
- ps: appveyor-retry cinst -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $Env:php_ver_target | Select-Object -first 1) -replace '[php|]','')
- ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
- cd c:\tools\php
- IF %PHP%==1 copy php.ini-production php.ini /Y
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
Expand All @@ -44,6 +44,7 @@ install:
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
- cd c:\projects\php-project-workspace
- composer config --unset platform.php
- IF %dependencies%==lowest appveyor-retry composer update --prefer-lowest --no-progress --profile -n
- IF %dependencies%==current appveyor-retry composer install --no-progress --profile
- IF %dependencies%==highest appveyor-retry composer update --no-progress --profile -n
Expand Down
73 changes: 65 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "api-clients/pusher",
"description": "Async first Pusher client",
"homepage": "https://php-api-clients.org/clients/pusher",
"license": "MIT",
"minimum-stability": "dev",
"prefer-stable": true,
"authors": [
{
"name": "Cees-Jan Kiewiet",
Expand All @@ -13,15 +12,17 @@
"require": {
"php": "^7.0",
"api-clients/command-bus": "^2.0",
"api-clients/rx-operators": "dev-master",
"api-clients/service": "dev-master",
"api-clients/rx-operators": "^2.0",
"clue/block-react": "^1.1",
"ocramius/package-versions": "^1.1",
"reactivex/rxphp": "^1.5.2",
"rx/websocket": "^0.9.2"
"react/dns": "^0.4.9",
"react/http-client": "^0.4.17",
"reactivex/rxphp": "^2.0",
"rx/websocket": "^1.0",
"voryx/event-loop": "^2.0.2"
},
"require-dev": {
"api-clients/test-utilities": "^2.0"
"api-clients/test-utilities": "^4.1"
},
"autoload": {
"psr-4": {
Expand All @@ -34,7 +35,10 @@
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"platform": {
"php": "7.0"
}
},
"extra": {
"api-clients": {
Expand All @@ -43,5 +47,58 @@
"namespace": "ApiClients\\Client\\Pusher\\CommandBus"
}
}
},
"scripts": {
"ensure-installed": "composer install --ansi -n -q",
"cs": [
"@ensure-installed",
"php-cs-fixer fix --config=.php_cs --ansi --dry-run --diff --verbose --allow-risky=yes --show-progress=estimating"
],
"cs-fix": [
"@ensure-installed",
"php-cs-fixer fix --config=.php_cs --ansi --verbose --allow-risky=yes --show-progress=estimating"
],
"unit": [
"@ensure-installed",
"phpunit --colors=always -c phpunit.xml.dist"
],
"unit-coverage": [
"@ensure-installed",
"phpunit --colors=always -c phpunit.xml.dist --coverage-text --coverage-html covHtml --coverage-clover ./build/logs/clover.xml"
],
"lint-php": [
"@ensure-installed",
"parallel-lint --exclude vendor ."
],
"qa-all": [
"@lint-php",
"@cs",
"@unit"
],
"qa-all-coverage": [
"@lint-php",
"@cs",
"@unit-coverage"
],
"qa-windows": [
"@lint-php",
"@cs",
"@unit"
],
"qa-ci": [
"@unit"
],
"qa-ci-extended": [
"@qa-all-coverage"
],
"qa-ci-windows": [
"@qa-windows"
],
"qa-contrib": [
"@qa-all"
],
"ci-coverage": [
"if [ -f ./build/logs/clover.xml ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi"
]
}
}
Loading

0 comments on commit ebd3a03

Please sign in to comment.