Skip to content

Commit c6c1f32

Browse files
committed
Updated QA settings for 5.1 test utilities2
1 parent fac9d85 commit c6c1f32

File tree

9 files changed

+111
-59
lines changed

9 files changed

+111
-59
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\CsFixerConfig\PhpCsFixerConfig;
4+
use PhpCsFixer\Config;
5+
6+
return (function (): Config
7+
{
8+
$paths = [
9+
__DIR__ . DIRECTORY_SEPARATOR . 'src',
10+
__DIR__ . DIRECTORY_SEPARATOR . '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: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,51 @@
11
language: php
2-
sudo: false
32

43
## Cache composer bits
54
cache:
65
directories:
7-
- $HOME/.composer/cache
8-
- $HOME/.humbug
9-
10-
## PHP versions we test against
11-
php:
12-
- 7.0
13-
- 7.1
14-
- nightly
6+
- $HOME/.composer/cache/files
157

168
## Build matrix for lowest and highest possible targets
179
matrix:
1810
include:
19-
- php: 7.0
20-
env: dependencies=lowest
21-
- php: 7.1
22-
env: dependencies=lowest
11+
- php: 7.2
12+
env:
13+
- qaExtended=true
14+
- dropPlatform=false
15+
- php: nightly
16+
env:
17+
- dropPlatform=false
18+
- php: 7.2
19+
env:
20+
- dependencies=lowest
21+
- dropPlatform=false
2322
- php: nightly
24-
env: dependencies=lowest
25-
- php: 7.0
26-
env: dependencies=highest
27-
- php: 7.1
28-
env: dependencies=highest
23+
env:
24+
- dependencies=lowest
25+
- dropPlatform=false
26+
- php: 7.2
27+
env:
28+
- dependencies=highest
29+
- dropPlatform=false
2930
- php: nightly
30-
env: dependencies=highest
31+
env:
32+
- dependencies=highest
33+
- dropPlatform=false
3134

3235
## Install or update dependencies
3336
install:
37+
- composer validate
38+
- if [ -z "$dropPlatform" ]; then composer config --unset platform.php; fi;
39+
- if [ -z "$qaExtended" ]; then phpenv config-rm xdebug.ini || :; fi;
3440
- if [ -z "$dependencies" ]; then composer install --prefer-dist; fi;
3541
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest --prefer-dist -n; fi;
3642
- if [ "$dependencies" = "highest" ]; then composer update --prefer-dist -n; fi;
3743
- composer show
3844

3945
## Run the actual test
40-
script: make ci
46+
script:
47+
- if [ -z "$qaExtended" ]; then make ci; fi;
48+
- if [ "$qaExtended" = "true" ]; then make ci-extended; fi;
4149

4250
## Gather coverage and set it to coverage servers
43-
after_script: make ci-coverage
51+
after_script: if [ "$qaExtended" = "true" ]; then make ci-coverage; fi;

Makefile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
all:
2-
composer qa-all
2+
composer run-script qa-all --timeout=0
3+
4+
all-coverage:
5+
composer run-script qa-all-coverage --timeout=0
36

47
ci:
5-
composer qa-ci
8+
composer run-script qa-ci --timeout=0
9+
10+
ci-extended:
11+
composer run-script qa-ci-extended --timeout=0
612

713
contrib:
8-
composer qa-contrib
14+
composer run-script qa-contrib --timeout=0
915

1016
init:
1117
composer ensure-installed
1218

1319
cs:
1420
composer cs
1521

22+
cs-fix:
23+
composer cs-fix
24+
1625
unit:
17-
composer unit
26+
composer run-script unit --timeout=0
27+
28+
unit-coverage:
29+
composer run-script unit-coverage --timeout=0
1830

1931
ci-coverage: init
2032
composer ci-coverage

appveyor.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,15 @@ clone_folder: c:\projects\php-project-workspace
77
environment:
88
matrix:
99
- dependencies: lowest
10-
php_ver_target: 7.0
11-
- dependencies: lowest
12-
php_ver_target: 7.1
13-
- dependencies: current
14-
php_ver_target: 7.0
10+
php_ver_target: 7.2
1511
- dependencies: current
16-
php_ver_target: 7.1
17-
- dependencies: highest
18-
php_ver_target: 7.0
12+
php_ver_target: 7.2
1913
- dependencies: highest
20-
php_ver_target: 7.1
14+
php_ver_target: 7.2
2115

22-
## Cache composer, chocolatey and php bits
16+
## Cache composer file
2317
cache:
2418
- '%LOCALAPPDATA%\Composer\files -> composer.lock'
25-
- composer.phar
26-
- C:\ProgramData\chocolatey\bin -> .appveyor.yml
27-
- C:\ProgramData\chocolatey\lib -> .appveyor.yml
28-
- c:\tools\php -> .appveyor.yml
2919

3020
## Set up environment varriables
3121
init:
@@ -48,6 +38,7 @@ install:
4838
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
4939
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
5040
- cd c:\projects\php-project-workspace
41+
- composer config --unset platform.php
5142
- IF %dependencies%==lowest appveyor-retry composer update --prefer-lowest --no-progress --profile -n
5243
- IF %dependencies%==current appveyor-retry composer install --no-progress --profile
5344
- IF %dependencies%==highest appveyor-retry composer update --no-progress --profile -n

composer.json

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
],
1010
"require": {
11-
"php": "^7.0",
11+
"php": "^7.2",
1212
"api-clients/middleware": "^4.0",
1313
"psr/log": "^1.0"
1414
},
@@ -27,28 +27,53 @@
2727
}
2828
},
2929
"config": {
30-
"sort-packages": true
30+
"sort-packages": true,
31+
"platform": {
32+
"php": "7.2"
33+
}
3134
},
3235
"scripts": {
3336
"ensure-installed": "composer install --ansi -n -q",
3437
"cs": [
3538
"@ensure-installed",
36-
"phpcs --standard=PSR2 src/"
39+
"php-cs-fixer fix --config=.php_cs --ansi --dry-run --diff --verbose --allow-risky=yes --show-progress=estimating"
40+
],
41+
"cs-fix": [
42+
"@ensure-installed",
43+
"php-cs-fixer fix --config=.php_cs --ansi --verbose --allow-risky=yes --show-progress=estimating"
3744
],
3845
"unit": [
3946
"@ensure-installed",
40-
"phpunit --colors=always -c phpunit.xml.dist --coverage-text --coverage-html covHtml"
47+
"phpunit --colors=always -c phpunit.xml.dist"
48+
],
49+
"unit-coverage": [
50+
"@ensure-installed",
51+
"phpunit --colors=always -c phpunit.xml.dist --coverage-text --coverage-html covHtml --coverage-clover ./build/logs/clover.xml"
52+
],
53+
"lint-php": [
54+
"@ensure-installed",
55+
"parallel-lint --exclude vendor ."
4156
],
4257
"qa-all": [
58+
"@lint-php",
4359
"@cs",
4460
"@unit"
4561
],
62+
"qa-all-coverage": [
63+
"@lint-php",
64+
"@cs",
65+
"@unit-coverage"
66+
],
4667
"qa-windows": [
68+
"@lint-php",
4769
"@cs",
4870
"@unit"
4971
],
5072
"qa-ci": [
51-
"@qa-all"
73+
"@unit"
74+
],
75+
"qa-ci-extended": [
76+
"@qa-all-coverage"
5277
],
5378
"qa-ci-windows": [
5479
"@qa-windows"

composer.lock

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/LoggerMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ protected function iterateHeaders(
136136
array $ignoreHeaders
137137
): array {
138138
foreach ($headers as $header => $value) {
139-
if (in_array($header, $ignoreHeaders)) {
139+
if (in_array($header, $ignoreHeaders, true)) {
140140
continue;
141141
}
142142

src/Options.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
namespace ApiClients\Middleware\Log;
44

5-
use ApiClients\Tools\Psr7\Oauth1\Definition\AccessToken;
6-
use ApiClients\Tools\Psr7\Oauth1\Definition\ConsumerKey;
7-
use ApiClients\Tools\Psr7\Oauth1\Definition\ConsumerSecret;
8-
use ApiClients\Tools\Psr7\Oauth1\Definition\TokenSecret;
9-
105
final class Options
116
{
127
const IGNORE_HEADERS = 'ignore_headers';

tests/LoggerMiddlewareTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public function testNoConfig()
4444
$middleware->error($exception, 'abc', $options);
4545
}
4646

47-
4847
public function testLog()
4948
{
5049
$options = [
@@ -126,9 +125,7 @@ public function testLogError()
126125
'X-Ignore-Request' => 'nope',
127126
]
128127
);
129-
$exception = new class(
130-
'New Exception'
131-
) extends Exception {
128+
$exception = new class('New Exception') extends Exception {
132129
public function getResponse()
133130
{
134131
return new Response(

0 commit comments

Comments
 (0)