Skip to content

Commit ebd3a03

Browse files
authored
Merge pull request #3 from php-api-clients/improvement-handle-disconnects-and-reconnect-when-appropriate
Improvement handle disconnects and reconnect when appropriate
2 parents b42dfd3 + 6a1c7fa commit ebd3a03

25 files changed

+1869
-482
lines changed

.php_cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php declare(strict_types=1);
2+
3+
use ApiClients\Tools\TestUtilities\PhpCsFixerConfig;
4+
5+
return (function ()
6+
{
7+
$path = __DIR__ . DIRECTORY_SEPARATOR;
8+
$paths = [
9+
$path . 'src',
10+
$path . 'tests',
11+
];
12+
13+
return PhpCsFixerConfig::create()
14+
->setFinder(
15+
PhpCsFixer\Finder::create()
16+
->in($paths)
17+
->append($paths)
18+
)
19+
->setUsingCache(false)
20+
;
21+
})();

.travis.yml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,51 @@ cache:
55
directories:
66
- $HOME/.composer/cache/files
77

8-
## PHP versions we test against
9-
php:
10-
- 7.0
11-
- 7.1
12-
- nightly
13-
148
## Build matrix for lowest and highest possible targets
159
matrix:
1610
include:
1711
- php: 7.0
18-
env: dependencies=lowest
12+
env:
13+
- qaExtended=true
14+
- php: 7.1
15+
- php: nightly
16+
env:
17+
- dropPlatform=false
18+
- php: 7.0
19+
env:
20+
- dependencies=lowest
1921
- php: 7.1
20-
env: dependencies=lowest
22+
env:
23+
- dependencies=lowest
2124
- php: nightly
22-
env: dependencies=lowest
25+
env:
26+
- dependencies=lowest
27+
- dropPlatform=false
2328
- php: 7.0
24-
env: dependencies=highest
29+
env:
30+
- dependencies=highest
2531
- php: 7.1
26-
env: dependencies=highest
32+
env:
33+
- dependencies=highest
2734
- php: nightly
28-
env: dependencies=highest
35+
env:
36+
- dependencies=highest
37+
- dropPlatform=false
2938

3039
## Install or update dependencies
3140
install:
41+
- composer validate
42+
- if [ -z "$dropPlatform" ]; then composer config --unset platform.php; fi;
43+
- if [ -z "$qaExtended" ]; then phpenv config-rm xdebug.ini || :; fi;
3244
- if [ -z "$dependencies" ]; then composer install --prefer-dist; fi;
3345
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest --prefer-dist -n; fi;
3446
- if [ "$dependencies" = "highest" ]; then composer update --prefer-dist -n; fi;
3547
- composer show
3648

3749
## Run the actual test
38-
script: make travis
50+
script:
51+
- if [ -z "$qaExtended" ]; then make ci; fi;
52+
- if [ "$qaExtended" = "true" ]; then make ci-extended; fi;
3953

4054
## Gather coverage and set it to coverage servers
41-
after_script: make travis-coverage
55+
after_script: if [ "$qaExtended" = "true" ]; then make ci-coverage; fi;

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 Cees-Jan Kiewiet
3+
Copyright (c) 2017 Cees-Jan Kiewiet
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
1-
all: cs unit
2-
travis: cs travis-unit
3-
contrib: cs unit
1+
all:
2+
composer run-script qa-all --timeout=0
3+
4+
all-coverage:
5+
composer run-script qa-all-coverage --timeout=0
6+
7+
ci:
8+
composer run-script qa-ci --timeout=0
9+
10+
ci-extended:
11+
composer run-script qa-ci-extended --timeout=0
12+
13+
contrib:
14+
composer run-script qa-contrib --timeout=0
415

516
init:
6-
if [ ! -d vendor ]; then composer install; fi;
17+
composer ensure-installed
18+
19+
cs:
20+
composer cs
721

8-
cs: init
9-
./vendor/bin/phpcs --standard=PSR2 src/
22+
cs-fix:
23+
composer cs-fix
1024

11-
unit: init
12-
./vendor/bin/phpunit --coverage-text --coverage-html covHtml
25+
unit:
26+
composer run-script unit --timeout=0
1327

14-
travis-unit: init
15-
./vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml
28+
unit-coverage:
29+
composer run-script unit-coverage --timeout=0
1630

17-
travis-coverage: init
18-
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
31+
ci-coverage: init
32+
composer ci-coverage

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
The MIT License (MIT)
1919

20-
Copyright (c) 2016 Cees-Jan Kiewiet
20+
Copyright (c) 2017 Cees-Jan Kiewiet
2121

2222
Permission is hereby granted, free of charge, to any person obtaining a copy
2323
of this software and associated documentation files (the "Software"), to deal

appveyor.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ environment:
1919
- dependencies: highest
2020
php_ver_target: 7.1
2121

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

@@ -33,7 +33,7 @@ init:
3333
## Install PHP and composer, and run the appropriate composer command
3434
install:
3535
- IF EXIST c:\tools\php (SET PHP=0)
36-
- 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|]','')
36+
- 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|]','')
3737
- cd c:\tools\php
3838
- IF %PHP%==1 copy php.ini-production php.ini /Y
3939
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
@@ -44,6 +44,7 @@ install:
4444
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
4545
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
4646
- cd c:\projects\php-project-workspace
47+
- composer config --unset platform.php
4748
- IF %dependencies%==lowest appveyor-retry composer update --prefer-lowest --no-progress --profile -n
4849
- IF %dependencies%==current appveyor-retry composer install --no-progress --profile
4950
- IF %dependencies%==highest appveyor-retry composer update --no-progress --profile -n

composer.json

Lines changed: 65 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
22
"name": "api-clients/pusher",
3+
"description": "Async first Pusher client",
34
"homepage": "https://php-api-clients.org/clients/pusher",
45
"license": "MIT",
5-
"minimum-stability": "dev",
6-
"prefer-stable": true,
76
"authors": [
87
{
98
"name": "Cees-Jan Kiewiet",
@@ -13,15 +12,17 @@
1312
"require": {
1413
"php": "^7.0",
1514
"api-clients/command-bus": "^2.0",
16-
"api-clients/rx-operators": "dev-master",
17-
"api-clients/service": "dev-master",
15+
"api-clients/rx-operators": "^2.0",
1816
"clue/block-react": "^1.1",
1917
"ocramius/package-versions": "^1.1",
20-
"reactivex/rxphp": "^1.5.2",
21-
"rx/websocket": "^0.9.2"
18+
"react/dns": "^0.4.9",
19+
"react/http-client": "^0.4.17",
20+
"reactivex/rxphp": "^2.0",
21+
"rx/websocket": "^1.0",
22+
"voryx/event-loop": "^2.0.2"
2223
},
2324
"require-dev": {
24-
"api-clients/test-utilities": "^2.0"
25+
"api-clients/test-utilities": "^4.1"
2526
},
2627
"autoload": {
2728
"psr-4": {
@@ -34,7 +35,10 @@
3435
}
3536
},
3637
"config": {
37-
"sort-packages": true
38+
"sort-packages": true,
39+
"platform": {
40+
"php": "7.0"
41+
}
3842
},
3943
"extra": {
4044
"api-clients": {
@@ -43,5 +47,58 @@
4347
"namespace": "ApiClients\\Client\\Pusher\\CommandBus"
4448
}
4549
}
50+
},
51+
"scripts": {
52+
"ensure-installed": "composer install --ansi -n -q",
53+
"cs": [
54+
"@ensure-installed",
55+
"php-cs-fixer fix --config=.php_cs --ansi --dry-run --diff --verbose --allow-risky=yes --show-progress=estimating"
56+
],
57+
"cs-fix": [
58+
"@ensure-installed",
59+
"php-cs-fixer fix --config=.php_cs --ansi --verbose --allow-risky=yes --show-progress=estimating"
60+
],
61+
"unit": [
62+
"@ensure-installed",
63+
"phpunit --colors=always -c phpunit.xml.dist"
64+
],
65+
"unit-coverage": [
66+
"@ensure-installed",
67+
"phpunit --colors=always -c phpunit.xml.dist --coverage-text --coverage-html covHtml --coverage-clover ./build/logs/clover.xml"
68+
],
69+
"lint-php": [
70+
"@ensure-installed",
71+
"parallel-lint --exclude vendor ."
72+
],
73+
"qa-all": [
74+
"@lint-php",
75+
"@cs",
76+
"@unit"
77+
],
78+
"qa-all-coverage": [
79+
"@lint-php",
80+
"@cs",
81+
"@unit-coverage"
82+
],
83+
"qa-windows": [
84+
"@lint-php",
85+
"@cs",
86+
"@unit"
87+
],
88+
"qa-ci": [
89+
"@unit"
90+
],
91+
"qa-ci-extended": [
92+
"@qa-all-coverage"
93+
],
94+
"qa-ci-windows": [
95+
"@qa-windows"
96+
],
97+
"qa-contrib": [
98+
"@qa-all"
99+
],
100+
"ci-coverage": [
101+
"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"
102+
]
46103
}
47104
}

0 commit comments

Comments
 (0)