2017 © Pedro Peláez
 

library phisby

REST API Endpoint Testing built on PHPUnit

image

phisby/phisby

REST API Endpoint Testing built on PHPUnit

  • Saturday, October 3, 2015
  • by FabioBatSIlva
  • Repository
  • 1 Watchers
  • 7 Stars
  • 92 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Phisby

Build Status Coverage Status, (*1)

A REST API testing framework inspired by frisby-js, written in PHP, (*2)

Documentation

Documentation for this library can be found on readthedocs, (*3)

Installation

Run the following composer command:, (*4)

$ 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(); } }

The Versions