https://github.com/phramework/testphase
API response testing tool
https://github.com/phramework/testphase
http-client restful-api testing-tools
Last synced: about 2 months ago
JSON representation
API response testing tool
- Host: GitHub
- URL: https://github.com/phramework/testphase
- Owner: phramework
- License: apache-2.0
- Created: 2015-11-22T20:34:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-29T23:34:12.000Z (about 9 years ago)
- Last Synced: 2025-09-30T17:39:10.753Z (6 months ago)
- Topics: http-client, restful-api, testing-tools
- Language: PHP
- Homepage: https://phramework.github.io/testphase/
- Size: 300 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING
- License: LICENSE
Awesome Lists containing this project
README
# testphase
API testing environment build for phramework and RESTful APIs
[](https://coveralls.io/github/phramework/testphase?branch=master) [](https://travis-ci.org/phramework/testphase)
[](https://styleci.io/repos/46678784)
## Usage
Require package using composer
```bash
composer require phramework/testphase
```
### Execute tests written in JSON files using command line
```
./vendon/bin/testphase help -b ./bootstrap.php -d ./tests-directory/
```
Inside your `bootstrap.php` file you MAY use the `Testphase::setBase` method to set the base url of your API. For example: `Testphase::setBase('http://localhost/myapp/api/');`
### Execute tests in PHP scripts
```php
$test = (new Testphase(
'posts/notFound',
'GET',
[
'Accept: application/json'
]
))
->expectStatusCode(404)
->expectJSON()
->run();
```
## Development
### Install
```bash
composer update
```
### Lint and test code
```bash
composer lint
composer test
```
Testing relies on [JSONPlaceholder](http://jsonplaceholder.typicode.com/) service.
### Generate documentation
```bash
composer doc
```
## License
Copyright 2015 - 2016 Xenofon Spafaridis
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
```
http://www.apache.org/licenses/LICENSE-2.0
```
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.