Skip to content

Commit f0bcb44

Browse files
committed
add tests advice
1 parent 4040256 commit f0bcb44

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

CONTRIBUTING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
11
# Contributing to WebPush
22
WebPush is an open source library.
33
Feel free to contribute by submitting a pull request or creating (and solving) issues!
4+
5+
## Running Tests
6+
7+
First, you will need to create your own configuration file by copying
8+
phpunit.dist.xml to phpunit.xml and filling in the fields you need for
9+
testing (i.e. STANDARD_ENDPOINT, GCM_API_KEY etc.).
10+
11+
Then, download [phpunit](https://phpunit.de/) and test with one of the
12+
following commands:
13+
14+
**For All Tests**
15+
`php phpunit.phar`
16+
17+
**For a Specific Test File**
18+
`php phpunit.phar tests/EncryptionTest.php`
19+
20+
**For a Single Test**
21+
`php phpunit.phar . --filter "/::testPadPayload( .*)?$/"` (regex)
22+
23+
Some tests have a custom decorator @skipIfTravis. The reason is that
24+
there's no way in Travis to update the push subscription, so the endpoint
25+
in my phpunit.travis.xml would ultimately expire
26+
(and require a human modification), and the corresponding tests would fail.
27+
But locally, these tests are handy.

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,5 @@ This library was inspired by the Node.js [marco-c/web-push](https://github.com/m
230230
## Contributing
231231
See [CONTRIBUTING.md](https://github.com/Minishlink/web-push/blob/master/CONTRIBUTING.md).
232232

233-
## Tests
234-
Copy `phpunit.xml` from `phpunit.dist.xml` and fill it with your test endpoints and private keys.
235-
236233
## License
237234
[MIT](https://github.com/Minishlink/web-push/blob/master/LICENSE)

0 commit comments

Comments
 (0)