Skip to content

Commit 02bfc17

Browse files
committed
Merge pull request #51 from webimpress/fix/docs
Docs fixes + Code coverage
2 parents 95d8705 + 91c202e commit 02bfc17

32 files changed

+167
-97
lines changed

.coveralls.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
coverage_clover: clover.xml
2+
json_path: coveralls-upload.json

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/test export-ignore
2+
.coveralls.yml export-ignore
3+
.gitattributes export-ignore
4+
.gitignore export-ignore
5+
.travis.yml export-ignore
6+
phpcs.xml export-ignore
7+
phpunit.xml.dist export-ignore

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
vendor/
2+
phpunit.xml
3+
clover.xml
4+
coveralls-upload.json

.travis.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ cache:
1010
env:
1111
global:
1212
- COMPOSER_ARGS="--no-interaction --ignore-platform-reqs"
13+
- COVERAGE_DEPS="satooshi/php-coveralls"
1314

1415
matrix:
15-
fast_finish: true
1616
include:
1717
- php: 5.6
1818
env:
1919
- DEPS=lowest
2020
- php: 5.6
2121
env:
2222
- DEPS=locked
23+
- TEST_COVERAGE=true
2324
- php: 5.6
2425
env:
2526
- DEPS=latest
@@ -33,18 +34,27 @@ matrix:
3334
- php: 7
3435
env:
3536
- DEPS=latest
36-
- php: hhvm
37+
- php: 7.1
3738
env:
3839
- DEPS=lowest
39-
- php: hhvm
40+
- php: 7.1
4041
env:
4142
- DEPS=locked
42-
- php: hhvm
43+
- php: 7.1
44+
env:
45+
- DEPS=latest
46+
- php: hhvm
47+
env:
48+
- DEPS=lowest
49+
- php: hhvm
50+
env:
51+
- DEPS=locked
52+
- php: hhvm
4353
env:
4454
- DEPS=latest
4555
allow_failures:
4656
- php: hhvm
47-
57+
4858
notifications:
4959
irc: "irc.freenode.org#apigility-dev"
5060
email: false
@@ -54,11 +64,15 @@ before_install:
5464
- travis_retry composer self-update
5565

5666
install:
67+
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi
5768
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
5869
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
5970
- travis_retry composer install $COMPOSER_ARGS
6071
- composer show
6172

6273
script:
63-
- composer test
74+
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
6475
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi
76+
77+
after_script:
78+
- if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi

CONDUCT.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Contributor Code of Conduct
2+
3+
The Zend Framework project adheres to [The Code Manifesto](http://codemanifesto.com)
4+
as its guidelines for contributor interactions.
5+
6+
## The Code Manifesto
7+
8+
We want to work in an ecosystem that empowers developers to reach their
9+
potential — one that encourages growth and effective collaboration. A space that
10+
is safe for all.
11+
12+
A space such as this benefits everyone that participates in it. It encourages
13+
new developers to enter our field. It is through discussion and collaboration
14+
that we grow, and through growth that we improve.
15+
16+
In the effort to create such a place, we hold to these values:
17+
18+
1. **Discrimination limits us.** This includes discrimination on the basis of
19+
race, gender, sexual orientation, gender identity, age, nationality, technology
20+
and any other arbitrary exclusion of a group of people.
21+
2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort
22+
levels. Remember that, and if brought to your attention, heed it.
23+
3. **We are our biggest assets.** None of us were born masters of our trade.
24+
Each of us has been helped along the way. Return that favor, when and where
25+
you can.
26+
4. **We are resources for the future.** As an extension of #3, share what you
27+
know. Make yourself a resource to help those that come after you.
28+
5. **Respect defines us.** Treat others as you wish to be treated. Make your
29+
discussions, criticisms and debates from a position of respectfulness. Ask
30+
yourself, is it true? Is it necessary? Is it constructive? Anything less is
31+
unacceptable.
32+
6. **Reactions require grace.** Angry responses are valid, but abusive language
33+
and vindictive actions are toxic. When something happens that offends you,
34+
handle it assertively, but be respectful. Escalate reasonably, and try to
35+
allow the offender an opportunity to explain themselves, and possibly correct
36+
the issue.
37+
7. **Opinions are just that: opinions.** Each and every one of us, due to our
38+
background and upbringing, have varying opinions. The fact of the matter, is
39+
that is perfectly acceptable. Remember this: if you respect your own
40+
opinions, you should respect the opinions of others.
41+
8. **To err is human.** You might not intend it, but mistakes do happen and
42+
contribute to build experience. Tolerate honest mistakes, and don't hesitate
43+
to apologize if you make one yourself.

CONTRIBUTING.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,28 @@ $ composer install
5353
To run tests, use the PHPUnit executable installed by Composer:
5454

5555
```console
56-
$ ./vendor/bin/phpunit
56+
$ composer test
5757
```
5858

5959
## CODING STANDARDS
6060

6161
While Apigility uses Zend Framework 2 coding standards, in practice, we check
62-
standards using [php-cs-fixer](https://github.com/fabpot/PHP-CS-Fixer) (which is
63-
installed via Composer with other dependencies). To check for CS issues:
62+
standards against PSR-1/2. To check for CS issues:
6463

6564
```console
66-
$ ./vendor/bin/php-cs-fixer fix . --dry-run
65+
$ composer cs-check
6766
```
6867

69-
This will report CS issues. Alternately, you can have the tool fix them for you
70-
by omitting the `--dry-run` switch:
68+
This will report CS issues. You can also attempt to fix many reported errors
69+
automatically:
7170

7271
```console
73-
$ ./vendor/bin/php-cs-fixer fix .
72+
$ composer cs-fix
7473
```
74+
75+
If you use `cs-fix` to fix issues, make certain you add and commit any files
76+
changed!
77+
78+
## Conduct
79+
80+
Please see our [CONDUCT.md](CONDUCT.md) to understand expected behavior when interacting with others in the project.

LICENSE.txt renamed to LICENSE.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
Copyright (c) 2014, Zend Technologies USA, Inc.
1+
Copyright (c) 2014-2016, Zend Technologies USA, Inc.
2+
23
All rights reserved.
34

45
Redistribution and use in source and binary forms, with or without modification,
56
are permitted provided that the following conditions are met:
67

7-
* Redistributions of source code must retain the above copyright notice,
8-
this list of conditions and the following disclaimer.
8+
- Redistributions of source code must retain the above copyright notice,
9+
this list of conditions and the following disclaimer.
910

10-
* Redistributions in binary form must reproduce the above copyright notice,
11-
this list of conditions and the following disclaimer in the documentation
12-
and/or other materials provided with the distribution.
11+
- Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
1314

14-
* Neither the name of Zend Technologies USA, Inc. nor the names of its
15-
contributors may be used to endorse or promote products derived from this
16-
software without specific prior written permission.
15+
- Neither the name of Zend Technologies USA, Inc. nor the names of its
16+
contributors may be used to endorse or promote products derived from this
17+
software without specific prior written permission.
1718

1819
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1920
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED

README.md

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
ZF Api Problem
22
==============
33

4-
[![Build Status](https://travis-ci.org/zfcampus/zf-api-problem.png)](https://travis-ci.org/zfcampus/zf-api-problem)
4+
[![Build Status](https://travis-ci.org/zfcampus/zf-api-problem.svg?branch=master)](https://travis-ci.org/zfcampus/zf-api-problem)
5+
[![Coverage Status](https://coveralls.io/repos/github/zfcampus/zf-api-problem/badge.svg?branch=master)](https://coveralls.io/github/zfcampus/zf-api-problem?branch=master)
56

67
Introduction
78
------------
@@ -22,14 +23,14 @@ Installation
2223
Run the following `composer` command:
2324

2425
```console
25-
$ composer require "zfcampus/zf-api-problem:~1.0-dev"
26+
$ composer require zfcampus/zf-api-problem
2627
```
2728

2829
Alternately, manually add the following to your `composer.json`, in the `require` section:
2930

3031
```javascript
3132
"require": {
32-
"zfcampus/zf-api-problem": "~1.0-dev"
33+
"zfcampus/zf-api-problem": "^1.2"
3334
}
3435
```
3536

@@ -39,18 +40,23 @@ Finally, add the module name to your project's `config/application.config.php` u
3940
key:
4041

4142
```php
42-
return array(
43+
return [
4344
/* ... */
44-
'modules' => array(
45+
'modules' => [
4546
/* ... */
4647
'ZF\ApiProblem',
47-
),
48+
],
4849
/* ... */
49-
);
50+
];
5051
```
5152

53+
> ### zf-component-installer
54+
>
55+
> If you use [zf-component-installer](https://github.com/zendframework/zf-component-installer),
56+
> that plugin will install zf-api-problem as a module for you.
57+
5258
Configuration
53-
-------------
59+
=============
5460

5561
### User Configuration
5662

@@ -74,26 +80,26 @@ The following configuration is provided in `config/module.config.php` to enable
7480
function:
7581

7682
```php
77-
'service_manager' => array(
78-
'aliases' => array(
83+
'service_manager' => [
84+
'aliases' => [
7985
'ZF\ApiProblem\ApiProblemListener' => 'ZF\ApiProblem\Listener\ApiProblemListener',
8086
'ZF\ApiProblem\RenderErrorListener' => 'ZF\ApiProblem\Listener\RenderErrorListener',
8187
'ZF\ApiProblem\ApiProblemRenderer' => 'ZF\ApiProblem\View\ApiProblemRenderer',
8288
'ZF\ApiProblem\ApiProblemStrategy' => 'ZF\ApiProblem\View\ApiProblemStrategy',
83-
),
84-
'factories' => array(
89+
],
90+
'factories' => [
8591
'ZF\ApiProblem\Listener\ApiProblemListener' => 'ZF\ApiProblem\Factory\ApiProblemListenerFactory',
8692
'ZF\ApiProblem\Listener\RenderErrorListener' => 'ZF\ApiProblem\Factory\RenderErrorListenerFactory',
8793
'ZF\ApiProblem\Listener\SendApiProblemResponseListener' => 'ZF\ApiProblem\Factory\SendApiProblemResponseListenerFactory',
8894
'ZF\ApiProblem\View\ApiProblemRenderer' => 'ZF\ApiProblem\Factory\ApiProblemRendererFactory',
8995
'ZF\ApiProblem\View\ApiProblemStrategy' => 'ZF\ApiProblem\Factory\ApiProblemStrategyFactory',
90-
),
91-
),
92-
'view_manager' => array(
96+
],
97+
],
98+
'view_manager' => [
9399
// Enable this in your application configuration in order to get full
94100
// exception stack traces in your API-Problem responses.
95101
'display_exceptions' => false,
96-
),
102+
],
97103
```
98104

99105
ZF2 Events
@@ -175,13 +181,14 @@ encountered. An instance of `ApiProblem` is typically wrapped in an
175181
constructor:
176182

177183
```php
178-
class ApiProblem {
184+
class ApiProblem
185+
{
179186
public function __construct(
180187
$status,
181188
$detail,
182189
$type = null,
183190
$title = null,
184-
array $additional = array()
191+
array $additional = []
185192
) {
186193
/* ... */
187194
}

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
},
3838
"require-dev": {
3939
"phpunit/phpunit": "^4.8",
40-
"squizlabs/php_codesniffer": "^2.7"
40+
"zendframework/zend-coding-standard": "~1.0.0"
4141
},
4242
"autoload": {
4343
"psr-4": {
@@ -54,8 +54,10 @@
5454
"@cs-check",
5555
"@test"
5656
],
57+
"upload-coverage": "coveralls -v",
5758
"cs-check": "phpcs",
5859
"cs-fix": "phpcbf",
59-
"test": "phpunit"
60+
"test": "phpunit",
61+
"test-coverage": "phpunit --coverage-clover clover.xml"
6062
}
6163
}

composer.lock

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

0 commit comments

Comments
 (0)