phisby / phisby
REST API Endpoint Testing built on PHPUnit
dev-master / 1.0.x-dev
2015-10-02 23:55 UTC
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ~6
- phpunit/phpunit: >=3.7.8
Requires (Dev)
- codeclimate/php-test-reporter: ~0.1
- instaclick/coding-standard: ~1.1
- instaclick/object-calisthenics-sniffs: dev-master
- instaclick/symfony2-coding-standard: dev-remaster
- php-mock/php-mock-phpunit: ^0.2
- satooshi/php-coveralls: ~0.6
- squizlabs/php_codesniffer: ~1.5
This package is auto-updated.
Last update: 2024-03-29 02:17:35 UTC
README
A REST API testing framework inspired by frisby-js, written in PHP
Documentation
Documentation for this library can be found on readthedocs
Installation
Run the following composer
command:
$ composer require "phisby/phisby"
Basic Usage.
use Phisby\Phisby $phisby = new Phisby(); $phisby ->get('http://localhost/api/1.0/users/3.json') ->expectStatus(200) ->expectJSONTypes('.', [ 'id' => 'integer', 'username' => 'string', 'is_admin' => 'boolean' ]) ->expectJSON('.',[ 'id' => 3, 'username' => 'johndoe', 'is_admin' => false ]) ->send();
PHPUnit test case.
use Phisby\PhisbyTestCase; class PhisbyTest extends PhisbyTestCase { public function testGithubSearch() { $this->phisby ->get('https://api.github.com/search/repositories?q=doctrine+language:php&sort=stars&order=desc&per_page=1') ->expectStatus(200) ->expectHeaders([ 'Content-Type' => 'application/json; charset=utf-8' ]) ->expectJSONTypes('.', [ 'total_count' => 'integer', 'incomplete_results' => 'boolean', 'items' => 'array' ]) ->expectJSONTypes('items[0]', [ 'id' => 'integer', 'name' => 'string', 'private' => 'boolean' ]) ->expectJSON('items[0]',[ 'id' => 597887, 'name' => 'doctrine2' ])->send(); } }