Skip to content

Commit 2773f40

Browse files
committed
Updated QA toolchain
- Use ZF >=2.3,<2.5 versions to retain PHP 5.3 compat - Use docker builds (faster) - Test PHP 5.3 - 5.6, 7, and HHVM - Only run CS checks on one version - Use phpcs instead of php-cs-fixer - Remove bootstrap for phpunit; use autoloader as bootstrap - Fix CS issues reported
1 parent 0a820ef commit 2773f40

File tree

7 files changed

+82
-133
lines changed

7 files changed

+82
-133
lines changed

.php_cs

Lines changed: 0 additions & 37 deletions
This file was deleted.

.travis.yml

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,39 @@
1-
language: php
1+
sudo: false
22

3-
php:
4-
- 5.3
5-
- 5.4
6-
- 5.5
3+
language: php
74

8-
before_script:
9-
- composer self-update
10-
- composer install --dev --prefer-source
5+
cache:
6+
directories:
7+
- $HOME/.composer/cache
118

12-
script:
13-
- ./vendor/bin/phpunit
14-
- ./vendor/bin/php-cs-fixer -v fix . --dry-run --config-file ./.php_cs
9+
matrix:
10+
fast_finish: true
11+
include:
12+
- php: 5.3
13+
- php: 5.4
14+
- php: 5.5
15+
env:
16+
- EXECUTE_CS_CHECK=true
17+
- php: 5.6
18+
env:
19+
- EXECUTE_COVERAGE=true
20+
- php: 7
21+
- php: hhvm
22+
allow_failures:
23+
- php: 7
24+
- php: hhvm
1525

1626
notifications:
1727
irc: "irc.freenode.org#apigility-dev"
1828
email: false
29+
30+
before_install:
31+
- if [[ $EXECUTE_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
32+
- composer self-update
33+
34+
install:
35+
- travis_retry composer install --no-interaction --ignore-platform-reqs --prefer-source
36+
37+
script:
38+
- ./vendor/bin/phpunit
39+
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/phpcs ; fi

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@
2828
},
2929
"require": {
3030
"php": ">=5.3.23",
31-
"zendframework/zend-eventmanager": "~2.3",
32-
"zendframework/zend-http": "~2.3",
33-
"zendframework/zend-json": "~2.3",
34-
"zendframework/zend-mvc": "~2.3",
35-
"zendframework/zend-view": "~2.3"
31+
"zendframework/zend-eventmanager": ">=2.3,<2.5",
32+
"zendframework/zend-http": ">=2.3,<2.5",
33+
"zendframework/zend-json": ">=2.3,<2.5",
34+
"zendframework/zend-mvc": ">=2.3,<2.5",
35+
"zendframework/zend-view": ">=2.3,<2.5"
3636
},
3737
"require-dev": {
38-
"fabpot/php-cs-fixer": "*@dev",
3938
"phpunit/PHPUnit": "3.7.*",
40-
"zendframework/zend-console": "~2.3",
41-
"zendframework/zend-loader": "~2.3"
39+
"zendframework/zend-console": ">=2.3,<2.5",
40+
"zendframework/zend-loader": ">=2.3,<2.5",
41+
"squizlabs/php_codesniffer": "^2.3"
4242
},
4343
"autoload": {
4444
"psr-4": {

phpcs.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Zend Framework coding standard">
3+
<description>Zend Framework coding standard</description>
4+
5+
<!-- display progress -->
6+
<arg value="p"/>
7+
<arg name="colors"/>
8+
9+
<!-- inherit rules from: -->
10+
<rule ref="PSR2"/>
11+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
12+
<properties>
13+
<property name="ignoreBlankLines" value="false"/>
14+
</properties>
15+
</rule>
16+
17+
<!-- Paths to check -->
18+
<file>src</file>
19+
<file>test</file>
20+
</ruleset>

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<phpunit bootstrap="./test/Bootstrap.php" colors="true">
1+
<phpunit bootstrap="./vendor/autoload.php" colors="true">
22
<testsuites>
33
<testsuite name="ZFApiProblem Module Tests">
44
<directory>./test</directory>

test/ApiProblemTest.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,21 +148,39 @@ public function testProvidedTitleIsUsedVerbatim()
148148

149149
public function testCanPassArbitraryDetailsToConstructor()
150150
{
151-
$problem = new ApiProblem(400, 'Invalid input', 'http://example.com/api/problem/400', 'Invalid entity', array('foo' => 'bar'));
151+
$problem = new ApiProblem(
152+
400,
153+
'Invalid input',
154+
'http://example.com/api/problem/400',
155+
'Invalid entity',
156+
array('foo' => 'bar')
157+
);
152158
$this->assertEquals('bar', $problem->foo);
153159
}
154160

155161
public function testArraySerializationIncludesArbitraryDetails()
156162
{
157-
$problem = new ApiProblem(400, 'Invalid input', 'http://example.com/api/problem/400', 'Invalid entity', array('foo' => 'bar'));
163+
$problem = new ApiProblem(
164+
400,
165+
'Invalid input',
166+
'http://example.com/api/problem/400',
167+
'Invalid entity',
168+
array('foo' => 'bar')
169+
);
158170
$array = $problem->toArray();
159171
$this->assertArrayHasKey('foo', $array);
160172
$this->assertEquals('bar', $array['foo']);
161173
}
162174

163175
public function testArbitraryDetailsShouldNotOverwriteRequiredFieldsInArraySerialization()
164176
{
165-
$problem = new ApiProblem(400, 'Invalid input', 'http://example.com/api/problem/400', 'Invalid entity', array('title' => 'SHOULD NOT GET THIS'));
177+
$problem = new ApiProblem(
178+
400,
179+
'Invalid input',
180+
'http://example.com/api/problem/400',
181+
'Invalid entity',
182+
array('title' => 'SHOULD NOT GET THIS')
183+
);
166184
$array = $problem->toArray();
167185
$this->assertArrayHasKey('title', $array);
168186
$this->assertEquals('Invalid entity', $array['title']);

test/Bootstrap.php

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)